﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace crdmcgui
{
    public class gui : Form
    {
        string filePath;
        public RulesetCollection Collection { get; set; }

        const string FileFilters = "CR Data Manager Configuration Files|*.dat|CR Data Manager Rules|*.dmr|All files (*.*)|*.*";

        #region Controls

        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.TabPage tabSimple;
        private System.Windows.Forms.TabPage tabText;
        private System.Windows.Forms.SplitContainer splitContainer1;
        private System.Windows.Forms.ToolStripContainer toolStripContainer1;
        private System.Windows.Forms.ToolStrip toolStrip1;
        private System.Windows.Forms.ToolStripButton btnRevert;
        private System.Windows.Forms.ToolStripButton btnSave;
        private System.Windows.Forms.ToolStripButton btnSaveAs;
        private System.Windows.Forms.TreeView tvCollectionTree;
        private System.Windows.Forms.Panel pnlGeneral;
        private System.Windows.Forms.Label label20;
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.TextBox txtCollectionNotes;
        private System.Windows.Forms.TextBox txtCollectionAuthor;
        private System.Windows.Forms.Label label17;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.Label label16;
        private System.Windows.Forms.Button btnCollectionRulesetAdd;
        private System.Windows.Forms.Button btnCollectionGroupAdd;
        private System.Windows.Forms.Button btnCollectionRulesetsRemove;
        private System.Windows.Forms.Button btnCollectionGroupRemove;
        private System.Windows.Forms.Panel pnlGroups;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnGroupGroupAdd;
        private System.Windows.Forms.Button btnGroupRulesetAdd;
        private System.Windows.Forms.Label commentLabel;
        private System.Windows.Forms.Button btnGroupGroupRemove;
        private System.Windows.Forms.TextBox txtGroupComment;
        private System.Windows.Forms.Button btnGroupRulesetRemove;
        private System.Windows.Forms.Label nameLabel;
        private System.Windows.Forms.TextBox txtGroupName;
        private System.Windows.Forms.Panel pnlRulesets;
        private System.Windows.Forms.TextBox txtRulesetComment;
        private System.Windows.Forms.TextBox txtRulesetName;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button btnRulesetRuleAdd;
        private System.Windows.Forms.Button btnRulesetActionAdd;
        private System.Windows.Forms.Button btnRulesetRuleClear;
        private System.Windows.Forms.PictureBox pictureBox2;
        private System.Windows.Forms.Button btnRulesetActionClear;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Button btnRulesetRuleUpdate;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button btnRulesetActionUpdate;
        private System.Windows.Forms.Button btnRulesetRuleRemove;
        private System.Windows.Forms.Button btnRulesetActionRemove;
        private System.Windows.Forms.Panel pnlVariables;
        private System.Windows.Forms.Button btnCollectionVariableClear;
        private System.Windows.Forms.Button btnCollectionVariableRemove;
        private System.Windows.Forms.Button btnCollectionVariableAdd;
        private System.Windows.Forms.Button btnCollectionVariableUpdate;
        private System.Windows.Forms.TextBox txtCollectionVariableValue;
        private System.Windows.Forms.TextBox txtCollectionVariableName;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.BindingSource CollectionBinder;
        private System.Windows.Forms.BindingSource CollectionVariablesBinder;
        private System.Windows.Forms.BindingSource CollectionGroupBinder;
        private System.Windows.Forms.BindingSource CollectionRulesetBinder;
        private System.Windows.Forms.BindingSource GroupBinder;
        private System.Windows.Forms.BindingSource GroupGroupBinder;
        private System.Windows.Forms.BindingSource GroupRulesetBinder;
        private System.Windows.Forms.BindingSource RulesetBinder;
        private System.Windows.Forms.BindingSource RuleBinder;
        private System.Windows.Forms.BindingSource ActionBinder;
        private System.Windows.Forms.ImageList imageList1;
        private System.Windows.Forms.TextBox txtActionNewValue;
        private System.Windows.Forms.ComboBox cmbActionAction;
        private System.Windows.Forms.ComboBox cmbActionField;
        private System.Windows.Forms.TextBox txtRuleTestValue;
        private System.Windows.Forms.ComboBox cmbRuleComparison;
        private System.Windows.Forms.ComboBox cmbRuleField;

        private System.Windows.Forms.DataGridView dgvGroupGroups;
        private System.Windows.Forms.DataGridView dgvGroupRulesets;
        private System.Windows.Forms.DataGridView dgvRulesetRules;
        private System.Windows.Forms.DataGridView dgvRulesetActions;
        private System.Windows.Forms.DataGridView dgvCollectionVariables;
        private System.Windows.Forms.DataGridView dgvCollectionRulesets;
        private System.Windows.Forms.DataGridView dgvCollectionGroups;



        #endregion

        private DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
        private DataGridViewTextBoxColumn quickViewDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn commentDataGridViewTextBoxColumn;
        private DataGridViewTextBoxColumn dgvtcRulesetRuleField;
        private DataGridViewTextBoxColumn dgvRulesetRuleComparison;
        private DataGridViewTextBoxColumn dgvtcRulesetRuleQuickView;
        private DataGridViewTextBoxColumn dgvtcRulesetRuleTestValue;
        private DataGridViewTextBoxColumn fieldDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn modifierDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn newValueDataGridViewTextBoxColumn;
        private DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn commentDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn groupCountDataGridViewTextBoxColumn;
        private DataGridViewTextBoxColumn rulesetCountDataGridViewTextBoxColumn;
        private ContextMenuStrip contextMenuStrip1;
        private ToolStripMenuItem cutToolStripMenuItem;
        private ToolStripMenuItem pasteToolStripMenuItem;
        private TextBox textBox1;
        private ToolTip toolTip1;
        private DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn2;
        private DataGridViewTextBoxColumn commentDataGridViewTextBoxColumn2;
        private DataGridViewTextBoxColumn groupCountDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn rulesetCountDataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn3;
        private DataGridViewTextBoxColumn quickViewDataGridViewTextBoxColumn2;
        private DataGridViewTextBoxColumn commentDataGridViewTextBoxColumn3;
        private DataGridViewTextBoxColumn keyDataGridViewTextBoxColumn;
        private DataGridViewTextBoxColumn valueDataGridViewTextBoxColumn;

        #region Initialization

        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        public gui()
        {
            InitializeComponent();
            cmbActionField.Items.AddRange(Enum.GetNames(typeof(AcceptedKeys)));
            cmbRuleField.Items.AddRange(Enum.GetNames(typeof(AcceptedValues)));
            if (cmbActionField.Items.Count > 0) cmbActionField.SelectedIndex = 0;
            if (cmbRuleField.Items.Count > 0) cmbRuleField.SelectedIndex = 0;
            Collection = new RulesetCollection();
            CollectionBinder.Add(Collection);
            this.Text = Application.ProductName + " Version " + Application.ProductVersion;
        }

        public gui(string strFileAndPath)
            : this()
        {
            this.filePath = strFileAndPath;
            //get the rules
            string[] tmpStrings = System.IO.File.ReadAllLines(strFileAndPath);
            Collection.Parse(tmpStrings);
            CollectionBinder.ResetItem(0);
        }

        private void gui_Shown(object sender, EventArgs e)
        {
            PopulateTree();
        }

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.Windows.Forms.Label commentLabel1;
            System.Windows.Forms.Label nameLabel1;
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(gui));
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabSimple = new System.Windows.Forms.TabPage();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.btnRevert = new System.Windows.Forms.ToolStripButton();
            this.btnSave = new System.Windows.Forms.ToolStripButton();
            this.btnSaveAs = new System.Windows.Forms.ToolStripButton();
            this.tvCollectionTree = new System.Windows.Forms.TreeView();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.pnlGeneral = new System.Windows.Forms.Panel();
            this.label20 = new System.Windows.Forms.Label();
            this.label18 = new System.Windows.Forms.Label();
            this.txtCollectionNotes = new System.Windows.Forms.TextBox();
            this.txtCollectionAuthor = new System.Windows.Forms.TextBox();
            this.label17 = new System.Windows.Forms.Label();
            this.label14 = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
            this.label16 = new System.Windows.Forms.Label();
            this.btnCollectionRulesetAdd = new System.Windows.Forms.Button();
            this.btnCollectionGroupAdd = new System.Windows.Forms.Button();
            this.dgvCollectionRulesets = new System.Windows.Forms.DataGridView();
            this.CollectionRulesetBinder = new System.Windows.Forms.BindingSource(this.components);
            this.btnCollectionRulesetsRemove = new System.Windows.Forms.Button();
            this.dgvCollectionGroups = new System.Windows.Forms.DataGridView();
            this.CollectionGroupBinder = new System.Windows.Forms.BindingSource(this.components);
            this.btnCollectionGroupRemove = new System.Windows.Forms.Button();
            this.pnlGroups = new System.Windows.Forms.Panel();
            this.label13 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.btnGroupGroupAdd = new System.Windows.Forms.Button();
            this.btnGroupRulesetAdd = new System.Windows.Forms.Button();
            this.dgvGroupGroups = new System.Windows.Forms.DataGridView();
            this.GroupGroupBinder = new System.Windows.Forms.BindingSource(this.components);
            this.dgvGroupRulesets = new System.Windows.Forms.DataGridView();
            this.GroupRulesetBinder = new System.Windows.Forms.BindingSource(this.components);
            this.commentLabel = new System.Windows.Forms.Label();
            this.btnGroupGroupRemove = new System.Windows.Forms.Button();
            this.txtGroupComment = new System.Windows.Forms.TextBox();
            this.btnGroupRulesetRemove = new System.Windows.Forms.Button();
            this.nameLabel = new System.Windows.Forms.Label();
            this.txtGroupName = new System.Windows.Forms.TextBox();
            this.pnlVariables = new System.Windows.Forms.Panel();
            this.btnCollectionVariableClear = new System.Windows.Forms.Button();
            this.btnCollectionVariableRemove = new System.Windows.Forms.Button();
            this.btnCollectionVariableAdd = new System.Windows.Forms.Button();
            this.btnCollectionVariableUpdate = new System.Windows.Forms.Button();
            this.txtCollectionVariableValue = new System.Windows.Forms.TextBox();
            this.txtCollectionVariableName = new System.Windows.Forms.TextBox();
            this.label12 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.dgvCollectionVariables = new System.Windows.Forms.DataGridView();
            this.pnlRulesets = new System.Windows.Forms.Panel();
            this.txtActionNewValue = new System.Windows.Forms.TextBox();
            this.cmbActionAction = new System.Windows.Forms.ComboBox();
            this.cmbActionField = new System.Windows.Forms.ComboBox();
            this.txtRuleTestValue = new System.Windows.Forms.TextBox();
            this.cmbRuleComparison = new System.Windows.Forms.ComboBox();
            this.cmbRuleField = new System.Windows.Forms.ComboBox();
            this.txtRulesetComment = new System.Windows.Forms.TextBox();
            this.txtRulesetName = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.dgvRulesetRules = new System.Windows.Forms.DataGridView();
            this.RuleBinder = new System.Windows.Forms.BindingSource(this.components);
            this.dgvRulesetActions = new System.Windows.Forms.DataGridView();
            this.ActionBinder = new System.Windows.Forms.BindingSource(this.components);
            this.btnRulesetRuleAdd = new System.Windows.Forms.Button();
            this.btnRulesetActionAdd = new System.Windows.Forms.Button();
            this.btnRulesetRuleClear = new System.Windows.Forms.Button();
            this.pictureBox2 = new System.Windows.Forms.PictureBox();
            this.btnRulesetActionClear = new System.Windows.Forms.Button();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.btnRulesetRuleUpdate = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.btnRulesetActionUpdate = new System.Windows.Forms.Button();
            this.btnRulesetRuleRemove = new System.Windows.Forms.Button();
            this.btnRulesetActionRemove = new System.Windows.Forms.Button();
            this.tabText = new System.Windows.Forms.TabPage();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.CollectionVariablesBinder = new System.Windows.Forms.BindingSource(this.components);
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.CollectionBinder = new System.Windows.Forms.BindingSource(this.components);
            this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.quickViewDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.commentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nameDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.commentDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.groupCountDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.rulesetCountDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nameDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.commentDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.groupCountDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.rulesetCountDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.GroupBinder = new System.Windows.Forms.BindingSource(this.components);
            this.nameDataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.quickViewDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.commentDataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.keyDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.valueDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.RulesetBinder = new System.Windows.Forms.BindingSource(this.components);
            this.dgvtcRulesetRuleField = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dgvRulesetRuleComparison = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dgvtcRulesetRuleQuickView = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dgvtcRulesetRuleTestValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.fieldDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.modifierDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.newValueDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            commentLabel1 = new System.Windows.Forms.Label();
            nameLabel1 = new System.Windows.Forms.Label();
            this.tabControl1.SuspendLayout();
            this.tabSimple.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
            this.toolStripContainer1.ContentPanel.SuspendLayout();
            this.toolStripContainer1.SuspendLayout();
            this.toolStrip1.SuspendLayout();
            this.pnlGeneral.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvCollectionRulesets)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionRulesetBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dgvCollectionGroups)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionGroupBinder)).BeginInit();
            this.pnlGroups.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvGroupGroups)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.GroupGroupBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dgvGroupRulesets)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.GroupRulesetBinder)).BeginInit();
            this.pnlVariables.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvCollectionVariables)).BeginInit();
            this.pnlRulesets.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvRulesetRules)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.RuleBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dgvRulesetActions)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ActionBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.tabText.SuspendLayout();
            this.contextMenuStrip1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionVariablesBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.GroupBinder)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.RulesetBinder)).BeginInit();
            this.SuspendLayout();
            // 
            // commentLabel1
            // 
            commentLabel1.AutoSize = true;
            commentLabel1.Location = new System.Drawing.Point(213, 17);
            commentLabel1.Name = "commentLabel1";
            commentLabel1.Size = new System.Drawing.Size(54, 13);
            commentLabel1.TabIndex = 18;
            commentLabel1.Text = "Comment:";
            // 
            // nameLabel1
            // 
            nameLabel1.AutoSize = true;
            nameLabel1.Location = new System.Drawing.Point(20, 17);
            nameLabel1.Name = "nameLabel1";
            nameLabel1.Size = new System.Drawing.Size(38, 13);
            nameLabel1.TabIndex = 16;
            nameLabel1.Text = "Name:";
            // 
            // tabControl1
            // 
            this.tabControl1.Controls.Add(this.tabSimple);
            this.tabControl1.Controls.Add(this.tabText);
            this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tabControl1.Location = new System.Drawing.Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(891, 622);
            this.tabControl1.TabIndex = 0;
            // 
            // tabSimple
            // 
            this.tabSimple.Controls.Add(this.splitContainer1);
            this.tabSimple.Location = new System.Drawing.Point(4, 22);
            this.tabSimple.Name = "tabSimple";
            this.tabSimple.Padding = new System.Windows.Forms.Padding(3);
            this.tabSimple.Size = new System.Drawing.Size(883, 596);
            this.tabSimple.TabIndex = 0;
            this.tabSimple.Text = "Simple";
            this.tabSimple.UseVisualStyleBackColor = true;
            // 
            // splitContainer1
            // 
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(3, 3);
            this.splitContainer1.Name = "splitContainer1";
            // 
            // splitContainer1.Panel1
            // 
            this.splitContainer1.Panel1.Controls.Add(this.toolStripContainer1);
            // 
            // splitContainer1.Panel2
            // 
            this.splitContainer1.Panel2.Controls.Add(this.pnlRulesets);
            this.splitContainer1.Panel2.Controls.Add(this.pnlGeneral);
            this.splitContainer1.Panel2.Controls.Add(this.pnlGroups);
            this.splitContainer1.Panel2.Controls.Add(this.pnlVariables);
            this.splitContainer1.Size = new System.Drawing.Size(877, 590);
            this.splitContainer1.SplitterDistance = 191;
            this.splitContainer1.TabIndex = 0;
            // 
            // toolStripContainer1
            // 
            // 
            // toolStripContainer1.BottomToolStripPanel
            // 
            this.toolStripContainer1.BottomToolStripPanel.Controls.Add(this.toolStrip1);
            // 
            // toolStripContainer1.ContentPanel
            // 
            this.toolStripContainer1.ContentPanel.Controls.Add(this.tvCollectionTree);
            this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(191, 565);
            this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.toolStripContainer1.LeftToolStripPanelVisible = false;
            this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
            this.toolStripContainer1.Name = "toolStripContainer1";
            this.toolStripContainer1.RightToolStripPanelVisible = false;
            this.toolStripContainer1.Size = new System.Drawing.Size(191, 590);
            this.toolStripContainer1.TabIndex = 0;
            this.toolStripContainer1.Text = "toolStripContainer1";
            this.toolStripContainer1.TopToolStripPanelVisible = false;
            // 
            // toolStrip1
            // 
            this.toolStrip1.CanOverflow = false;
            this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
            this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.btnRevert,
            this.btnSave,
            this.btnSaveAs});
            this.toolStrip1.Location = new System.Drawing.Point(0, 0);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new System.Drawing.Size(191, 25);
            this.toolStrip1.Stretch = true;
            this.toolStrip1.TabIndex = 0;
            // 
            // btnRevert
            // 
            this.btnRevert.Image = global::crdmcgui.Properties.Resources.refresh;
            this.btnRevert.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnRevert.Name = "btnRevert";
            this.btnRevert.Size = new System.Drawing.Size(60, 22);
            this.btnRevert.Text = "Revert";
            this.btnRevert.ToolTipText = "Revert To Last Save";
            this.btnRevert.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnRevert_MouseUp);
            // 
            // btnSave
            // 
            this.btnSave.Image = global::crdmcgui.Properties.Resources.accept;
            this.btnSave.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new System.Drawing.Size(51, 22);
            this.btnSave.Text = "Save";
            this.btnSave.ToolTipText = "Save Current Changes";
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            // 
            // btnSaveAs
            // 
            this.btnSaveAs.Image = global::crdmcgui.Properties.Resources.folder_accept;
            this.btnSaveAs.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnSaveAs.Name = "btnSaveAs";
            this.btnSaveAs.Size = new System.Drawing.Size(76, 22);
            this.btnSaveAs.Text = "Save As...";
            this.btnSaveAs.ToolTipText = "Save a copy of current changes";
            this.btnSaveAs.Click += new System.EventHandler(this.btnSaveAs_Click);
            // 
            // tvCollectionTree
            // 
            this.tvCollectionTree.AllowDrop = true;
            this.tvCollectionTree.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tvCollectionTree.HideSelection = false;
            this.tvCollectionTree.HotTracking = true;
            this.tvCollectionTree.ImageIndex = 0;
            this.tvCollectionTree.ImageList = this.imageList1;
            this.tvCollectionTree.Location = new System.Drawing.Point(0, 0);
            this.tvCollectionTree.Name = "tvCollectionTree";
            this.tvCollectionTree.SelectedImageIndex = 0;
            this.tvCollectionTree.Size = new System.Drawing.Size(191, 565);
            this.tvCollectionTree.TabIndex = 0;
            this.tvCollectionTree.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.tvCollectionTree_AfterLabelEdit);
            this.tvCollectionTree.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.tvCollectionTree_ItemDrag);
            this.tvCollectionTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvCollectionTree_AfterSelect);
            this.tvCollectionTree.DragDrop += new System.Windows.Forms.DragEventHandler(this.tvCollectionTree_DragDrop);
            this.tvCollectionTree.DragEnter += new System.Windows.Forms.DragEventHandler(this.tvCollectionTree_DragEnter);
            this.tvCollectionTree.DragOver += new System.Windows.Forms.DragEventHandler(this.tvCollectionTree_DragOver);
            this.tvCollectionTree.DragLeave += new System.EventHandler(this.tvCollectionTree_DragLeave);
            this.tvCollectionTree.GiveFeedback += new System.Windows.Forms.GiveFeedbackEventHandler(this.tvCollectionTree_GiveFeedback);
            this.tvCollectionTree.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.tvCollectionTree_QueryContinueDrag);
            // 
            // imageList1
            // 
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "DataMan32.png");
            this.imageList1.Images.SetKeyName(1, "warning.png");
            this.imageList1.Images.SetKeyName(2, "Lightning.png");
            this.imageList1.Images.SetKeyName(3, "folder.png");
            this.imageList1.Images.SetKeyName(4, "folder_accept.png");
            this.imageList1.Images.SetKeyName(5, "folder_full.png");
            this.imageList1.Images.SetKeyName(6, "add_to_folder.png");
            this.imageList1.Images.SetKeyName(7, "delete_folder.png");
            this.imageList1.Images.SetKeyName(8, "add_page.png");
            this.imageList1.Images.SetKeyName(9, "accept_page.png");
            this.imageList1.Images.SetKeyName(10, "delete_page.png");
            this.imageList1.Images.SetKeyName(11, "info.png");
            this.imageList1.Images.SetKeyName(12, "Up.png");
            this.imageList1.Images.SetKeyName(13, "Down.png");
            this.imageList1.Images.SetKeyName(14, "comment.png");
            this.imageList1.Images.SetKeyName(15, "refresh.png");
            this.imageList1.Images.SetKeyName(16, "Search.png");
            this.imageList1.Images.SetKeyName(17, "add.png");
            this.imageList1.Images.SetKeyName(18, "delete.png");
            this.imageList1.Images.SetKeyName(19, "accept.png");
            this.imageList1.Images.SetKeyName(20, "directory.png");
            this.imageList1.Images.SetKeyName(21, "directory_opened.png");
            this.imageList1.Images.SetKeyName(22, "Cut.png");
            this.imageList1.Images.SetKeyName(23, "paste.png");
            // 
            // pnlGeneral
            // 
            this.pnlGeneral.Controls.Add(this.label20);
            this.pnlGeneral.Controls.Add(this.label18);
            this.pnlGeneral.Controls.Add(this.txtCollectionNotes);
            this.pnlGeneral.Controls.Add(this.txtCollectionAuthor);
            this.pnlGeneral.Controls.Add(this.label17);
            this.pnlGeneral.Controls.Add(this.label14);
            this.pnlGeneral.Controls.Add(this.label15);
            this.pnlGeneral.Controls.Add(this.label16);
            this.pnlGeneral.Controls.Add(this.btnCollectionRulesetAdd);
            this.pnlGeneral.Controls.Add(this.btnCollectionGroupAdd);
            this.pnlGeneral.Controls.Add(this.dgvCollectionRulesets);
            this.pnlGeneral.Controls.Add(this.btnCollectionRulesetsRemove);
            this.pnlGeneral.Controls.Add(this.dgvCollectionGroups);
            this.pnlGeneral.Controls.Add(this.btnCollectionGroupRemove);
            this.pnlGeneral.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlGeneral.Location = new System.Drawing.Point(0, 0);
            this.pnlGeneral.Name = "pnlGeneral";
            this.pnlGeneral.Size = new System.Drawing.Size(682, 590);
            this.pnlGeneral.TabIndex = 15;
            // 
            // label20
            // 
            this.label20.AutoSize = true;
            this.label20.Location = new System.Drawing.Point(21, 477);
            this.label20.Name = "label20";
            this.label20.Size = new System.Drawing.Size(35, 13);
            this.label20.TabIndex = 10;
            this.label20.Text = "Notes";
            // 
            // label18
            // 
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(20, 455);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(35, 13);
            this.label18.TabIndex = 10;
            this.label18.Text = "Name";
            // 
            // txtCollectionNotes
            // 
            this.txtCollectionNotes.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.CollectionBinder, "Notes", true));
            this.txtCollectionNotes.Location = new System.Drawing.Point(67, 477);
            this.txtCollectionNotes.Multiline = true;
            this.txtCollectionNotes.Name = "txtCollectionNotes";
            this.txtCollectionNotes.Size = new System.Drawing.Size(600, 96);
            this.txtCollectionNotes.TabIndex = 9;
            // 
            // txtCollectionAuthor
            // 
            this.txtCollectionAuthor.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.CollectionBinder, "Author", true));
            this.txtCollectionAuthor.Location = new System.Drawing.Point(67, 451);
            this.txtCollectionAuthor.Name = "txtCollectionAuthor";
            this.txtCollectionAuthor.Size = new System.Drawing.Size(162, 20);
            this.txtCollectionAuthor.TabIndex = 9;
            // 
            // label17
            // 
            this.label17.AutoSize = true;
            this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label17.Location = new System.Drawing.Point(7, 431);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(70, 16);
            this.label17.TabIndex = 6;
            this.label17.Text = "Author Info";
            // 
            // label14
            // 
            this.label14.AutoSize = true;
            this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label14.Location = new System.Drawing.Point(18, 251);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(199, 16);
            this.label14.TabIndex = 6;
            this.label14.Text = "Orphaned Rulesets In Collection";
            // 
            // label15
            // 
            this.label15.AutoSize = true;
            this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label15.Location = new System.Drawing.Point(14, 62);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(127, 16);
            this.label15.TabIndex = 6;
            this.label15.Text = "Groups In Collection";
            // 
            // label16
            // 
            this.label16.AutoSize = true;
            this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label16.Location = new System.Drawing.Point(13, 9);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(452, 39);
            this.label16.TabIndex = 6;
            this.label16.Text = "Ruleset Collection Overview";
            // 
            // btnCollectionRulesetAdd
            // 
            this.btnCollectionRulesetAdd.ImageIndex = 17;
            this.btnCollectionRulesetAdd.ImageList = this.imageList1;
            this.btnCollectionRulesetAdd.Location = new System.Drawing.Point(509, 408);
            this.btnCollectionRulesetAdd.Name = "btnCollectionRulesetAdd";
            this.btnCollectionRulesetAdd.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionRulesetAdd.TabIndex = 1;
            this.btnCollectionRulesetAdd.Text = "Add";
            this.btnCollectionRulesetAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionRulesetAdd.UseVisualStyleBackColor = true;
            this.btnCollectionRulesetAdd.Click += new System.EventHandler(this.btnCollectionRulesetsAdd_Click);
            // 
            // btnCollectionGroupAdd
            // 
            this.btnCollectionGroupAdd.ImageIndex = 17;
            this.btnCollectionGroupAdd.ImageList = this.imageList1;
            this.btnCollectionGroupAdd.Location = new System.Drawing.Point(509, 218);
            this.btnCollectionGroupAdd.Name = "btnCollectionGroupAdd";
            this.btnCollectionGroupAdd.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionGroupAdd.TabIndex = 1;
            this.btnCollectionGroupAdd.Text = "Add";
            this.btnCollectionGroupAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionGroupAdd.UseVisualStyleBackColor = true;
            this.btnCollectionGroupAdd.Click += new System.EventHandler(this.btnCollectionGroupAdd_Click);
            // 
            // dgvCollectionRulesets
            // 
            this.dgvCollectionRulesets.AllowUserToAddRows = false;
            this.dgvCollectionRulesets.AllowUserToDeleteRows = false;
            this.dgvCollectionRulesets.AutoGenerateColumns = false;
            this.dgvCollectionRulesets.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvCollectionRulesets.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvCollectionRulesets.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
            this.dgvCollectionRulesets.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvCollectionRulesets.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.nameDataGridViewTextBoxColumn,
            this.quickViewDataGridViewTextBoxColumn1,
            this.commentDataGridViewTextBoxColumn});
            this.dgvCollectionRulesets.DataSource = this.CollectionRulesetBinder;
            this.dgvCollectionRulesets.Location = new System.Drawing.Point(14, 273);
            this.dgvCollectionRulesets.MultiSelect = false;
            this.dgvCollectionRulesets.Name = "dgvCollectionRulesets";
            this.dgvCollectionRulesets.RowHeadersWidth = 25;
            this.dgvCollectionRulesets.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgvCollectionRulesets.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvCollectionRulesets.Size = new System.Drawing.Size(656, 129);
            this.dgvCollectionRulesets.TabIndex = 5;
            this.dgvCollectionRulesets.TabStop = false;
            this.dgvCollectionRulesets.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGroupRulesets_CellEndEdit);
            this.dgvCollectionRulesets.RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvCollectionRulesets_RowHeaderMouseDoubleClick);
            // 
            // CollectionRulesetBinder
            // 
            this.CollectionRulesetBinder.DataMember = "Rulesets";
            this.CollectionRulesetBinder.DataSource = this.CollectionBinder;
            this.CollectionRulesetBinder.PositionChanged += new System.EventHandler(this.CollectionRulesetBinder_PositionChanged);
            // 
            // btnCollectionRulesetsRemove
            // 
            this.btnCollectionRulesetsRemove.Enabled = false;
            this.btnCollectionRulesetsRemove.ImageIndex = 18;
            this.btnCollectionRulesetsRemove.ImageList = this.imageList1;
            this.btnCollectionRulesetsRemove.Location = new System.Drawing.Point(590, 408);
            this.btnCollectionRulesetsRemove.Name = "btnCollectionRulesetsRemove";
            this.btnCollectionRulesetsRemove.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionRulesetsRemove.TabIndex = 1;
            this.btnCollectionRulesetsRemove.Text = "Remove";
            this.btnCollectionRulesetsRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionRulesetsRemove.UseVisualStyleBackColor = true;
            this.btnCollectionRulesetsRemove.Click += new System.EventHandler(this.btnCollectionRulesetsRemove_Click);
            // 
            // dgvCollectionGroups
            // 
            this.dgvCollectionGroups.AllowUserToAddRows = false;
            this.dgvCollectionGroups.AllowUserToDeleteRows = false;
            this.dgvCollectionGroups.AutoGenerateColumns = false;
            this.dgvCollectionGroups.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvCollectionGroups.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvCollectionGroups.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
            this.dgvCollectionGroups.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvCollectionGroups.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.nameDataGridViewTextBoxColumn1,
            this.commentDataGridViewTextBoxColumn1,
            this.groupCountDataGridViewTextBoxColumn,
            this.rulesetCountDataGridViewTextBoxColumn});
            this.dgvCollectionGroups.DataSource = this.CollectionGroupBinder;
            this.dgvCollectionGroups.Location = new System.Drawing.Point(11, 83);
            this.dgvCollectionGroups.MultiSelect = false;
            this.dgvCollectionGroups.Name = "dgvCollectionGroups";
            this.dgvCollectionGroups.RowHeadersWidth = 25;
            this.dgvCollectionGroups.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgvCollectionGroups.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvCollectionGroups.Size = new System.Drawing.Size(656, 129);
            this.dgvCollectionGroups.TabIndex = 5;
            this.dgvCollectionGroups.TabStop = false;
            this.dgvCollectionGroups.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGroupGroups_CellEndEdit);
            this.dgvCollectionGroups.RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvCollectionGroups_RowHeaderMouseDoubleClick);
            // 
            // CollectionGroupBinder
            // 
            this.CollectionGroupBinder.DataMember = "Groups";
            this.CollectionGroupBinder.DataSource = this.CollectionBinder;
            this.CollectionGroupBinder.PositionChanged += new System.EventHandler(this.CollectionGroupBinder_PositionChanged);
            // 
            // btnCollectionGroupRemove
            // 
            this.btnCollectionGroupRemove.Enabled = false;
            this.btnCollectionGroupRemove.ImageIndex = 18;
            this.btnCollectionGroupRemove.ImageList = this.imageList1;
            this.btnCollectionGroupRemove.Location = new System.Drawing.Point(590, 218);
            this.btnCollectionGroupRemove.Name = "btnCollectionGroupRemove";
            this.btnCollectionGroupRemove.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionGroupRemove.TabIndex = 1;
            this.btnCollectionGroupRemove.Text = "Remove";
            this.btnCollectionGroupRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionGroupRemove.UseVisualStyleBackColor = true;
            this.btnCollectionGroupRemove.Click += new System.EventHandler(this.btnCollectionGroupRemove_Click);
            // 
            // pnlGroups
            // 
            this.pnlGroups.Controls.Add(this.label13);
            this.pnlGroups.Controls.Add(this.label7);
            this.pnlGroups.Controls.Add(this.label1);
            this.pnlGroups.Controls.Add(this.btnGroupGroupAdd);
            this.pnlGroups.Controls.Add(this.btnGroupRulesetAdd);
            this.pnlGroups.Controls.Add(this.dgvGroupGroups);
            this.pnlGroups.Controls.Add(this.dgvGroupRulesets);
            this.pnlGroups.Controls.Add(this.commentLabel);
            this.pnlGroups.Controls.Add(this.btnGroupGroupRemove);
            this.pnlGroups.Controls.Add(this.txtGroupComment);
            this.pnlGroups.Controls.Add(this.btnGroupRulesetRemove);
            this.pnlGroups.Controls.Add(this.nameLabel);
            this.pnlGroups.Controls.Add(this.txtGroupName);
            this.pnlGroups.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlGroups.Location = new System.Drawing.Point(0, 0);
            this.pnlGroups.Name = "pnlGroups";
            this.pnlGroups.Size = new System.Drawing.Size(682, 590);
            this.pnlGroups.TabIndex = 16;
            // 
            // label13
            // 
            this.label13.AutoSize = true;
            this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label13.Location = new System.Drawing.Point(13, 129);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(134, 16);
            this.label13.TabIndex = 6;
            this.label13.Text = "Groups In This Group";
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label7.Location = new System.Drawing.Point(12, 354);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(143, 16);
            this.label7.TabIndex = 6;
            this.label7.Text = "Rulesets In This Group";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(13, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(268, 39);
            this.label1.TabIndex = 6;
            this.label1.Text = "Group Overview";
            // 
            // btnGroupGroupAdd
            // 
            this.btnGroupGroupAdd.ImageIndex = 17;
            this.btnGroupGroupAdd.ImageList = this.imageList1;
            this.btnGroupGroupAdd.Location = new System.Drawing.Point(502, 331);
            this.btnGroupGroupAdd.Name = "btnGroupGroupAdd";
            this.btnGroupGroupAdd.Size = new System.Drawing.Size(83, 23);
            this.btnGroupGroupAdd.TabIndex = 1;
            this.btnGroupGroupAdd.Text = "Add";
            this.btnGroupGroupAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnGroupGroupAdd.UseVisualStyleBackColor = true;
            this.btnGroupGroupAdd.Click += new System.EventHandler(this.btnGroupGroupAdd_Click);
            // 
            // btnGroupRulesetAdd
            // 
            this.btnGroupRulesetAdd.ImageIndex = 17;
            this.btnGroupRulesetAdd.ImageList = this.imageList1;
            this.btnGroupRulesetAdd.Location = new System.Drawing.Point(502, 559);
            this.btnGroupRulesetAdd.Name = "btnGroupRulesetAdd";
            this.btnGroupRulesetAdd.Size = new System.Drawing.Size(83, 23);
            this.btnGroupRulesetAdd.TabIndex = 1;
            this.btnGroupRulesetAdd.Text = "Add";
            this.btnGroupRulesetAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnGroupRulesetAdd.UseVisualStyleBackColor = true;
            this.btnGroupRulesetAdd.Click += new System.EventHandler(this.btnGroupRulesetAdd_Click);
            // 
            // dgvGroupGroups
            // 
            this.dgvGroupGroups.AllowUserToAddRows = false;
            this.dgvGroupGroups.AllowUserToDeleteRows = false;
            this.dgvGroupGroups.AutoGenerateColumns = false;
            this.dgvGroupGroups.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvGroupGroups.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvGroupGroups.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
            this.dgvGroupGroups.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvGroupGroups.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.nameDataGridViewTextBoxColumn2,
            this.commentDataGridViewTextBoxColumn2,
            this.groupCountDataGridViewTextBoxColumn1,
            this.rulesetCountDataGridViewTextBoxColumn1});
            this.dgvGroupGroups.DataSource = this.GroupGroupBinder;
            this.dgvGroupGroups.Location = new System.Drawing.Point(10, 152);
            this.dgvGroupGroups.MultiSelect = false;
            this.dgvGroupGroups.Name = "dgvGroupGroups";
            this.dgvGroupGroups.RowHeadersWidth = 25;
            this.dgvGroupGroups.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgvGroupGroups.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvGroupGroups.Size = new System.Drawing.Size(660, 173);
            this.dgvGroupGroups.TabIndex = 5;
            this.dgvGroupGroups.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGroupGroups_CellEndEdit);
            this.dgvGroupGroups.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvCollectionGroups_RowHeaderMouseDoubleClick);
            // 
            // GroupGroupBinder
            // 
            this.GroupGroupBinder.DataMember = "Groups";
            this.GroupGroupBinder.DataSource = this.GroupBinder;
            this.GroupGroupBinder.PositionChanged += new System.EventHandler(this.GroupGroupBinder_PositionChanged);
            // 
            // dgvGroupRulesets
            // 
            this.dgvGroupRulesets.AllowUserToAddRows = false;
            this.dgvGroupRulesets.AllowUserToDeleteRows = false;
            this.dgvGroupRulesets.AutoGenerateColumns = false;
            this.dgvGroupRulesets.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvGroupRulesets.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvGroupRulesets.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
            this.dgvGroupRulesets.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvGroupRulesets.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.nameDataGridViewTextBoxColumn3,
            this.quickViewDataGridViewTextBoxColumn2,
            this.commentDataGridViewTextBoxColumn3});
            this.dgvGroupRulesets.DataSource = this.GroupRulesetBinder;
            this.dgvGroupRulesets.Location = new System.Drawing.Point(8, 376);
            this.dgvGroupRulesets.MultiSelect = false;
            this.dgvGroupRulesets.Name = "dgvGroupRulesets";
            this.dgvGroupRulesets.RowHeadersWidth = 25;
            this.dgvGroupRulesets.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgvGroupRulesets.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvGroupRulesets.Size = new System.Drawing.Size(660, 177);
            this.dgvGroupRulesets.TabIndex = 5;
            this.dgvGroupRulesets.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGroupRulesets_CellEndEdit);
            this.dgvGroupRulesets.RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvCollectionRulesets_RowHeaderMouseDoubleClick);
            // 
            // GroupRulesetBinder
            // 
            this.GroupRulesetBinder.DataMember = "Rulesets";
            this.GroupRulesetBinder.DataSource = this.GroupBinder;
            this.GroupRulesetBinder.PositionChanged += new System.EventHandler(this.GroupRulesetBinder_PositionChanged);
            // 
            // commentLabel
            // 
            this.commentLabel.AutoSize = true;
            this.commentLabel.Location = new System.Drawing.Point(7, 89);
            this.commentLabel.Name = "commentLabel";
            this.commentLabel.Size = new System.Drawing.Size(54, 13);
            this.commentLabel.TabIndex = 0;
            this.commentLabel.Text = "Comment:";
            // 
            // btnGroupGroupRemove
            // 
            this.btnGroupGroupRemove.ImageIndex = 18;
            this.btnGroupGroupRemove.ImageList = this.imageList1;
            this.btnGroupGroupRemove.Location = new System.Drawing.Point(587, 331);
            this.btnGroupGroupRemove.Name = "btnGroupGroupRemove";
            this.btnGroupGroupRemove.Size = new System.Drawing.Size(83, 23);
            this.btnGroupGroupRemove.TabIndex = 1;
            this.btnGroupGroupRemove.Text = "Remove";
            this.btnGroupGroupRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnGroupGroupRemove.UseVisualStyleBackColor = true;
            this.btnGroupGroupRemove.Click += new System.EventHandler(this.btnGroupGroupRemove_Click);
            // 
            // txtGroupComment
            // 
            this.txtGroupComment.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.GroupBinder, "Comment", true));
            this.txtGroupComment.Location = new System.Drawing.Point(67, 86);
            this.txtGroupComment.Name = "txtGroupComment";
            this.txtGroupComment.Size = new System.Drawing.Size(575, 20);
            this.txtGroupComment.TabIndex = 1;
            this.txtGroupComment.Validated += new System.EventHandler(this.txtRulesetComment_Validated);
            // 
            // btnGroupRulesetRemove
            // 
            this.btnGroupRulesetRemove.ImageIndex = 18;
            this.btnGroupRulesetRemove.ImageList = this.imageList1;
            this.btnGroupRulesetRemove.Location = new System.Drawing.Point(587, 559);
            this.btnGroupRulesetRemove.Name = "btnGroupRulesetRemove";
            this.btnGroupRulesetRemove.Size = new System.Drawing.Size(83, 23);
            this.btnGroupRulesetRemove.TabIndex = 1;
            this.btnGroupRulesetRemove.Text = "Remove";
            this.btnGroupRulesetRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnGroupRulesetRemove.UseVisualStyleBackColor = true;
            this.btnGroupRulesetRemove.Click += new System.EventHandler(this.btnGroupRulesetRemove_Click);
            // 
            // nameLabel
            // 
            this.nameLabel.AutoSize = true;
            this.nameLabel.Location = new System.Drawing.Point(7, 63);
            this.nameLabel.Name = "nameLabel";
            this.nameLabel.Size = new System.Drawing.Size(38, 13);
            this.nameLabel.TabIndex = 4;
            this.nameLabel.Text = "Name:";
            // 
            // txtGroupName
            // 
            this.txtGroupName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.GroupBinder, "Name", true));
            this.txtGroupName.Location = new System.Drawing.Point(67, 60);
            this.txtGroupName.Name = "txtGroupName";
            this.txtGroupName.Size = new System.Drawing.Size(248, 20);
            this.txtGroupName.TabIndex = 5;
            this.txtGroupName.Validated += new System.EventHandler(this.txtGroupName_Validated);
            // 
            // pnlVariables
            // 
            this.pnlVariables.Controls.Add(this.btnCollectionVariableClear);
            this.pnlVariables.Controls.Add(this.btnCollectionVariableRemove);
            this.pnlVariables.Controls.Add(this.btnCollectionVariableAdd);
            this.pnlVariables.Controls.Add(this.btnCollectionVariableUpdate);
            this.pnlVariables.Controls.Add(this.txtCollectionVariableValue);
            this.pnlVariables.Controls.Add(this.txtCollectionVariableName);
            this.pnlVariables.Controls.Add(this.label12);
            this.pnlVariables.Controls.Add(this.label11);
            this.pnlVariables.Controls.Add(this.label10);
            this.pnlVariables.Controls.Add(this.label9);
            this.pnlVariables.Controls.Add(this.dgvCollectionVariables);
            this.pnlVariables.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlVariables.Location = new System.Drawing.Point(0, 0);
            this.pnlVariables.Name = "pnlVariables";
            this.pnlVariables.Size = new System.Drawing.Size(682, 590);
            this.pnlVariables.TabIndex = 18;
            // 
            // btnCollectionVariableClear
            // 
            this.btnCollectionVariableClear.ImageIndex = 7;
            this.btnCollectionVariableClear.ImageList = this.imageList1;
            this.btnCollectionVariableClear.Location = new System.Drawing.Point(593, 562);
            this.btnCollectionVariableClear.Name = "btnCollectionVariableClear";
            this.btnCollectionVariableClear.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionVariableClear.TabIndex = 6;
            this.btnCollectionVariableClear.Text = "Clear All";
            this.btnCollectionVariableClear.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionVariableClear.UseVisualStyleBackColor = true;
            // 
            // btnCollectionVariableRemove
            // 
            this.btnCollectionVariableRemove.ImageIndex = 18;
            this.btnCollectionVariableRemove.ImageList = this.imageList1;
            this.btnCollectionVariableRemove.Location = new System.Drawing.Point(506, 562);
            this.btnCollectionVariableRemove.Name = "btnCollectionVariableRemove";
            this.btnCollectionVariableRemove.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionVariableRemove.TabIndex = 6;
            this.btnCollectionVariableRemove.Text = "Remove";
            this.btnCollectionVariableRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionVariableRemove.UseVisualStyleBackColor = true;
            // 
            // btnCollectionVariableAdd
            // 
            this.btnCollectionVariableAdd.ImageIndex = 17;
            this.btnCollectionVariableAdd.ImageList = this.imageList1;
            this.btnCollectionVariableAdd.Location = new System.Drawing.Point(419, 562);
            this.btnCollectionVariableAdd.Name = "btnCollectionVariableAdd";
            this.btnCollectionVariableAdd.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionVariableAdd.TabIndex = 6;
            this.btnCollectionVariableAdd.Text = "Add";
            this.btnCollectionVariableAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionVariableAdd.UseVisualStyleBackColor = true;
            // 
            // btnCollectionVariableUpdate
            // 
            this.btnCollectionVariableUpdate.ImageIndex = 15;
            this.btnCollectionVariableUpdate.ImageList = this.imageList1;
            this.btnCollectionVariableUpdate.Location = new System.Drawing.Point(332, 562);
            this.btnCollectionVariableUpdate.Name = "btnCollectionVariableUpdate";
            this.btnCollectionVariableUpdate.Size = new System.Drawing.Size(79, 23);
            this.btnCollectionVariableUpdate.TabIndex = 6;
            this.btnCollectionVariableUpdate.Text = "Update";
            this.btnCollectionVariableUpdate.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnCollectionVariableUpdate.UseVisualStyleBackColor = true;
            // 
            // txtCollectionVariableValue
            // 
            this.txtCollectionVariableValue.Location = new System.Drawing.Point(289, 534);
            this.txtCollectionVariableValue.Name = "txtCollectionVariableValue";
            this.txtCollectionVariableValue.Size = new System.Drawing.Size(381, 20);
            this.txtCollectionVariableValue.TabIndex = 5;
            // 
            // txtCollectionVariableName
            // 
            this.txtCollectionVariableName.Location = new System.Drawing.Point(95, 534);
            this.txtCollectionVariableName.Name = "txtCollectionVariableName";
            this.txtCollectionVariableName.Size = new System.Drawing.Size(142, 20);
            this.txtCollectionVariableName.TabIndex = 5;
            // 
            // label12
            // 
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(249, 538);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(34, 13);
            this.label12.TabIndex = 4;
            this.label12.Text = "Value";
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(15, 538);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(76, 13);
            this.label11.TabIndex = 3;
            this.label11.Text = "Variable Name";
            // 
            // label10
            // 
            this.label10.Location = new System.Drawing.Point(17, 33);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(416, 19);
            this.label10.TabIndex = 2;
            this.label10.Text = "You can create Variables and set their values to use in When CR Data Manager runs" +
                "\r\n";
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label9.Location = new System.Drawing.Point(5, 5);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(310, 29);
            this.label9.TabIndex = 1;
            this.label9.Text = "CR Data Manager Variables";
            // 
            // dgvCollectionVariables
            // 
            this.dgvCollectionVariables.AutoGenerateColumns = false;
            this.dgvCollectionVariables.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvCollectionVariables.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvCollectionVariables.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvCollectionVariables.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.keyDataGridViewTextBoxColumn,
            this.valueDataGridViewTextBoxColumn});
            this.dgvCollectionVariables.DataMember = "Variables";
            this.dgvCollectionVariables.DataSource = this.CollectionBinder;
            this.dgvCollectionVariables.Location = new System.Drawing.Point(11, 55);
            this.dgvCollectionVariables.Name = "dgvCollectionVariables";
            this.dgvCollectionVariables.ReadOnly = true;
            this.dgvCollectionVariables.RowHeadersVisible = false;
            this.dgvCollectionVariables.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgvCollectionVariables.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvCollectionVariables.Size = new System.Drawing.Size(661, 473);
            this.dgvCollectionVariables.TabIndex = 0;
            // 
            // pnlRulesets
            // 
            this.pnlRulesets.Controls.Add(this.txtActionNewValue);
            this.pnlRulesets.Controls.Add(this.cmbActionAction);
            this.pnlRulesets.Controls.Add(this.cmbActionField);
            this.pnlRulesets.Controls.Add(this.txtRuleTestValue);
            this.pnlRulesets.Controls.Add(this.cmbRuleComparison);
            this.pnlRulesets.Controls.Add(this.cmbRuleField);
            this.pnlRulesets.Controls.Add(commentLabel1);
            this.pnlRulesets.Controls.Add(this.txtRulesetComment);
            this.pnlRulesets.Controls.Add(nameLabel1);
            this.pnlRulesets.Controls.Add(this.txtRulesetName);
            this.pnlRulesets.Controls.Add(this.label2);
            this.pnlRulesets.Controls.Add(this.dgvRulesetRules);
            this.pnlRulesets.Controls.Add(this.dgvRulesetActions);
            this.pnlRulesets.Controls.Add(this.btnRulesetRuleAdd);
            this.pnlRulesets.Controls.Add(this.btnRulesetActionAdd);
            this.pnlRulesets.Controls.Add(this.btnRulesetRuleClear);
            this.pnlRulesets.Controls.Add(this.pictureBox2);
            this.pnlRulesets.Controls.Add(this.btnRulesetActionClear);
            this.pnlRulesets.Controls.Add(this.pictureBox1);
            this.pnlRulesets.Controls.Add(this.btnRulesetRuleUpdate);
            this.pnlRulesets.Controls.Add(this.label3);
            this.pnlRulesets.Controls.Add(this.btnRulesetActionUpdate);
            this.pnlRulesets.Controls.Add(this.btnRulesetRuleRemove);
            this.pnlRulesets.Controls.Add(this.btnRulesetActionRemove);
            this.pnlRulesets.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlRulesets.Location = new System.Drawing.Point(0, 0);
            this.pnlRulesets.Name = "pnlRulesets";
            this.pnlRulesets.Size = new System.Drawing.Size(682, 590);
            this.pnlRulesets.TabIndex = 17;
            // 
            // txtActionNewValue
            // 
            this.txtActionNewValue.Location = new System.Drawing.Point(431, 523);
            this.txtActionNewValue.Name = "txtActionNewValue";
            this.txtActionNewValue.Size = new System.Drawing.Size(239, 20);
            this.txtActionNewValue.TabIndex = 24;
            // 
            // cmbActionAction
            // 
            this.cmbActionAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbActionAction.FormattingEnabled = true;
            this.cmbActionAction.Location = new System.Drawing.Point(222, 522);
            this.cmbActionAction.Name = "cmbActionAction";
            this.cmbActionAction.Size = new System.Drawing.Size(201, 21);
            this.cmbActionAction.TabIndex = 23;
            this.cmbActionAction.SelectedIndexChanged += new System.EventHandler(this.cmbActionAction_SelectedIndexChanged);
            // 
            // cmbActionField
            // 
            this.cmbActionField.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbActionField.FormattingEnabled = true;
            this.cmbActionField.Location = new System.Drawing.Point(13, 522);
            this.cmbActionField.Name = "cmbActionField";
            this.cmbActionField.Size = new System.Drawing.Size(201, 21);
            this.cmbActionField.TabIndex = 22;
            this.cmbActionField.SelectedIndexChanged += new System.EventHandler(this.cmbActionField_SelectedIndexChanged);
            // 
            // txtRuleTestValue
            // 
            this.txtRuleTestValue.Location = new System.Drawing.Point(431, 294);
            this.txtRuleTestValue.Name = "txtRuleTestValue";
            this.txtRuleTestValue.Size = new System.Drawing.Size(239, 20);
            this.txtRuleTestValue.TabIndex = 21;
            // 
            // cmbRuleComparison
            // 
            this.cmbRuleComparison.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbRuleComparison.FormattingEnabled = true;
            this.cmbRuleComparison.Location = new System.Drawing.Point(222, 293);
            this.cmbRuleComparison.Name = "cmbRuleComparison";
            this.cmbRuleComparison.Size = new System.Drawing.Size(201, 21);
            this.cmbRuleComparison.TabIndex = 20;
            this.cmbRuleComparison.SelectedIndexChanged += new System.EventHandler(this.cmbRuleComparison_SelectedIndexChanged);
            // 
            // cmbRuleField
            // 
            this.cmbRuleField.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbRuleField.FormattingEnabled = true;
            this.cmbRuleField.Location = new System.Drawing.Point(13, 293);
            this.cmbRuleField.Name = "cmbRuleField";
            this.cmbRuleField.Size = new System.Drawing.Size(201, 21);
            this.cmbRuleField.TabIndex = 20;
            this.cmbRuleField.SelectedIndexChanged += new System.EventHandler(this.cmbRuleField_SelectedIndexChanged);
            // 
            // txtRulesetComment
            // 
            this.txtRulesetComment.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.RulesetBinder, "Comment", true));
            this.txtRulesetComment.Location = new System.Drawing.Point(273, 14);
            this.txtRulesetComment.Name = "txtRulesetComment";
            this.txtRulesetComment.Size = new System.Drawing.Size(399, 20);
            this.txtRulesetComment.TabIndex = 19;
            this.txtRulesetComment.Validated += new System.EventHandler(this.txtRulesetComment_Validated);
            // 
            // txtRulesetName
            // 
            this.txtRulesetName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.RulesetBinder, "Name", true));
            this.txtRulesetName.Location = new System.Drawing.Point(64, 14);
            this.txtRulesetName.Name = "txtRulesetName";
            this.txtRulesetName.Size = new System.Drawing.Size(132, 20);
            this.txtRulesetName.TabIndex = 17;
            this.txtRulesetName.Validated += new System.EventHandler(this.txtRulesetName_Validated);
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.Location = new System.Drawing.Point(8, 48);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(39, 13);
            this.label2.TabIndex = 6;
            this.label2.Text = "Rules";
            // 
            // dgvRulesetRules
            // 
            this.dgvRulesetRules.AllowUserToAddRows = false;
            this.dgvRulesetRules.AllowUserToDeleteRows = false;
            this.dgvRulesetRules.AllowUserToResizeRows = false;
            this.dgvRulesetRules.AutoGenerateColumns = false;
            this.dgvRulesetRules.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvRulesetRules.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvRulesetRules.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.dgvtcRulesetRuleField,
            this.dgvRulesetRuleComparison,
            this.dgvtcRulesetRuleQuickView,
            this.dgvtcRulesetRuleTestValue});
            this.dgvRulesetRules.DataSource = this.RuleBinder;
            this.dgvRulesetRules.Location = new System.Drawing.Point(12, 64);
            this.dgvRulesetRules.MultiSelect = false;
            this.dgvRulesetRules.Name = "dgvRulesetRules";
            this.dgvRulesetRules.ReadOnly = true;
            this.dgvRulesetRules.RowHeadersWidth = 25;
            this.dgvRulesetRules.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvRulesetRules.Size = new System.Drawing.Size(658, 223);
            this.dgvRulesetRules.TabIndex = 1;
            // 
            // RuleBinder
            // 
            this.RuleBinder.DataMember = "Rules";
            this.RuleBinder.DataSource = this.RulesetBinder;
            this.RuleBinder.PositionChanged += new System.EventHandler(this.RuleBinder_PositionChanged);
            // 
            // dgvRulesetActions
            // 
            this.dgvRulesetActions.AllowUserToAddRows = false;
            this.dgvRulesetActions.AllowUserToDeleteRows = false;
            this.dgvRulesetActions.AllowUserToResizeRows = false;
            this.dgvRulesetActions.AutoGenerateColumns = false;
            this.dgvRulesetActions.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvRulesetActions.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgvRulesetActions.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.fieldDataGridViewTextBoxColumn1,
            this.modifierDataGridViewTextBoxColumn1,
            this.newValueDataGridViewTextBoxColumn});
            this.dgvRulesetActions.DataSource = this.ActionBinder;
            this.dgvRulesetActions.Location = new System.Drawing.Point(12, 367);
            this.dgvRulesetActions.MultiSelect = false;
            this.dgvRulesetActions.Name = "dgvRulesetActions";
            this.dgvRulesetActions.ReadOnly = true;
            this.dgvRulesetActions.RowHeadersWidth = 25;
            this.dgvRulesetActions.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvRulesetActions.Size = new System.Drawing.Size(660, 149);
            this.dgvRulesetActions.TabIndex = 1;
            // 
            // ActionBinder
            // 
            this.ActionBinder.DataMember = "Actions";
            this.ActionBinder.DataSource = this.RulesetBinder;
            this.ActionBinder.PositionChanged += new System.EventHandler(this.ActionBinder_PositionChanged);
            // 
            // btnRulesetRuleAdd
            // 
            this.btnRulesetRuleAdd.ImageIndex = 17;
            this.btnRulesetRuleAdd.ImageList = this.imageList1;
            this.btnRulesetRuleAdd.Location = new System.Drawing.Point(357, 320);
            this.btnRulesetRuleAdd.Name = "btnRulesetRuleAdd";
            this.btnRulesetRuleAdd.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetRuleAdd.TabIndex = 3;
            this.btnRulesetRuleAdd.Text = "Add";
            this.btnRulesetRuleAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetRuleAdd.UseVisualStyleBackColor = true;
            this.btnRulesetRuleAdd.Click += new System.EventHandler(this.btnRulesetRuleAdd_Click);
            // 
            // btnRulesetActionAdd
            // 
            this.btnRulesetActionAdd.ImageIndex = 17;
            this.btnRulesetActionAdd.ImageList = this.imageList1;
            this.btnRulesetActionAdd.Location = new System.Drawing.Point(357, 550);
            this.btnRulesetActionAdd.Name = "btnRulesetActionAdd";
            this.btnRulesetActionAdd.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetActionAdd.TabIndex = 3;
            this.btnRulesetActionAdd.Text = "Add";
            this.btnRulesetActionAdd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetActionAdd.UseVisualStyleBackColor = true;
            this.btnRulesetActionAdd.Click += new System.EventHandler(this.btnRulesetActionAdd_Click);
            // 
            // btnRulesetRuleClear
            // 
            this.btnRulesetRuleClear.ImageIndex = 7;
            this.btnRulesetRuleClear.ImageList = this.imageList1;
            this.btnRulesetRuleClear.Location = new System.Drawing.Point(565, 320);
            this.btnRulesetRuleClear.Name = "btnRulesetRuleClear";
            this.btnRulesetRuleClear.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetRuleClear.TabIndex = 3;
            this.btnRulesetRuleClear.Text = "Clear Rules";
            this.btnRulesetRuleClear.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetRuleClear.UseVisualStyleBackColor = true;
            this.btnRulesetRuleClear.Click += new System.EventHandler(this.btnRulesetRuleClear_Click);
            // 
            // pictureBox2
            // 
            this.pictureBox2.BackColor = System.Drawing.Color.Black;
            this.pictureBox2.Location = new System.Drawing.Point(67, 52);
            this.pictureBox2.Name = "pictureBox2";
            this.pictureBox2.Size = new System.Drawing.Size(603, 1);
            this.pictureBox2.TabIndex = 7;
            this.pictureBox2.TabStop = false;
            // 
            // btnRulesetActionClear
            // 
            this.btnRulesetActionClear.ImageIndex = 7;
            this.btnRulesetActionClear.ImageList = this.imageList1;
            this.btnRulesetActionClear.Location = new System.Drawing.Point(565, 550);
            this.btnRulesetActionClear.Name = "btnRulesetActionClear";
            this.btnRulesetActionClear.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetActionClear.TabIndex = 3;
            this.btnRulesetActionClear.Text = "Clear Actions";
            this.btnRulesetActionClear.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetActionClear.UseVisualStyleBackColor = true;
            this.btnRulesetActionClear.Click += new System.EventHandler(this.btnRulesetActionClear_Click);
            // 
            // pictureBox1
            // 
            this.pictureBox1.BackColor = System.Drawing.Color.Black;
            this.pictureBox1.Location = new System.Drawing.Point(67, 357);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(603, 1);
            this.pictureBox1.TabIndex = 7;
            this.pictureBox1.TabStop = false;
            // 
            // btnRulesetRuleUpdate
            // 
            this.btnRulesetRuleUpdate.ImageIndex = 15;
            this.btnRulesetRuleUpdate.ImageList = this.imageList1;
            this.btnRulesetRuleUpdate.Location = new System.Drawing.Point(253, 320);
            this.btnRulesetRuleUpdate.Name = "btnRulesetRuleUpdate";
            this.btnRulesetRuleUpdate.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetRuleUpdate.TabIndex = 3;
            this.btnRulesetRuleUpdate.Text = "Update";
            this.btnRulesetRuleUpdate.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetRuleUpdate.UseVisualStyleBackColor = true;
            this.btnRulesetRuleUpdate.Click += new System.EventHandler(this.btnRulesetRuleUpdate_Click);
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(15, 350);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(49, 13);
            this.label3.TabIndex = 6;
            this.label3.Text = "Actions";
            // 
            // btnRulesetActionUpdate
            // 
            this.btnRulesetActionUpdate.ImageIndex = 15;
            this.btnRulesetActionUpdate.ImageList = this.imageList1;
            this.btnRulesetActionUpdate.Location = new System.Drawing.Point(253, 550);
            this.btnRulesetActionUpdate.Name = "btnRulesetActionUpdate";
            this.btnRulesetActionUpdate.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetActionUpdate.TabIndex = 3;
            this.btnRulesetActionUpdate.Text = "Update";
            this.btnRulesetActionUpdate.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetActionUpdate.UseVisualStyleBackColor = true;
            this.btnRulesetActionUpdate.Click += new System.EventHandler(this.btnRulesetActionUpdate_Click);
            // 
            // btnRulesetRuleRemove
            // 
            this.btnRulesetRuleRemove.ImageIndex = 18;
            this.btnRulesetRuleRemove.ImageList = this.imageList1;
            this.btnRulesetRuleRemove.Location = new System.Drawing.Point(461, 320);
            this.btnRulesetRuleRemove.Name = "btnRulesetRuleRemove";
            this.btnRulesetRuleRemove.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetRuleRemove.TabIndex = 3;
            this.btnRulesetRuleRemove.Text = "Remove";
            this.btnRulesetRuleRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetRuleRemove.UseVisualStyleBackColor = true;
            this.btnRulesetRuleRemove.Click += new System.EventHandler(this.btnRulesetRuleRemove_Click);
            // 
            // btnRulesetActionRemove
            // 
            this.btnRulesetActionRemove.ImageIndex = 18;
            this.btnRulesetActionRemove.ImageList = this.imageList1;
            this.btnRulesetActionRemove.Location = new System.Drawing.Point(461, 550);
            this.btnRulesetActionRemove.Name = "btnRulesetActionRemove";
            this.btnRulesetActionRemove.Size = new System.Drawing.Size(104, 23);
            this.btnRulesetActionRemove.TabIndex = 3;
            this.btnRulesetActionRemove.Text = "Remove";
            this.btnRulesetActionRemove.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this.btnRulesetActionRemove.UseVisualStyleBackColor = true;
            this.btnRulesetActionRemove.Click += new System.EventHandler(this.btnRulesetActionRemove_Click);
            // 
            // tabText
            // 
            this.tabText.Controls.Add(this.textBox1);
            this.tabText.Location = new System.Drawing.Point(4, 22);
            this.tabText.Name = "tabText";
            this.tabText.Padding = new System.Windows.Forms.Padding(3);
            this.tabText.Size = new System.Drawing.Size(883, 596);
            this.tabText.TabIndex = 1;
            this.tabText.Text = "Text View";
            this.tabText.UseVisualStyleBackColor = true;
            // 
            // textBox1
            // 
            this.textBox1.AcceptsReturn = true;
            this.textBox1.AcceptsTab = true;
            this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.CollectionBinder, "TextVersion", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
            this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textBox1.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.textBox1.HideSelection = false;
            this.textBox1.Location = new System.Drawing.Point(3, 3);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.textBox1.Size = new System.Drawing.Size(877, 590);
            this.textBox1.TabIndex = 49;
            this.textBox1.TabStop = false;
            this.textBox1.WordWrap = false;
            // 
            // contextMenuStrip1
            // 
            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.cutToolStripMenuItem,
            this.pasteToolStripMenuItem});
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new System.Drawing.Size(103, 48);
            // 
            // cutToolStripMenuItem
            // 
            this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
            this.cutToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
            this.cutToolStripMenuItem.Text = "Cut";
            // 
            // pasteToolStripMenuItem
            // 
            this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
            this.pasteToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
            this.pasteToolStripMenuItem.Text = "Paste";
            // 
            // CollectionVariablesBinder
            // 
            this.CollectionVariablesBinder.DataMember = "Variables";
            this.CollectionVariablesBinder.DataSource = this.CollectionBinder;
            // 
            // CollectionBinder
            // 
            this.CollectionBinder.DataSource = typeof(crdmcgui.RulesetCollection);
            // 
            // nameDataGridViewTextBoxColumn
            // 
            this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
            this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
            this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
            // 
            // quickViewDataGridViewTextBoxColumn1
            // 
            this.quickViewDataGridViewTextBoxColumn1.DataPropertyName = "QuickView";
            this.quickViewDataGridViewTextBoxColumn1.HeaderText = "QuickView";
            this.quickViewDataGridViewTextBoxColumn1.Name = "quickViewDataGridViewTextBoxColumn1";
            this.quickViewDataGridViewTextBoxColumn1.ReadOnly = true;
            // 
            // commentDataGridViewTextBoxColumn
            // 
            this.commentDataGridViewTextBoxColumn.DataPropertyName = "Comment";
            this.commentDataGridViewTextBoxColumn.HeaderText = "Comment";
            this.commentDataGridViewTextBoxColumn.Name = "commentDataGridViewTextBoxColumn";
            // 
            // nameDataGridViewTextBoxColumn1
            // 
            this.nameDataGridViewTextBoxColumn1.DataPropertyName = "Name";
            this.nameDataGridViewTextBoxColumn1.HeaderText = "Name";
            this.nameDataGridViewTextBoxColumn1.Name = "nameDataGridViewTextBoxColumn1";
            // 
            // commentDataGridViewTextBoxColumn1
            // 
            this.commentDataGridViewTextBoxColumn1.DataPropertyName = "Comment";
            this.commentDataGridViewTextBoxColumn1.HeaderText = "Comment";
            this.commentDataGridViewTextBoxColumn1.Name = "commentDataGridViewTextBoxColumn1";
            // 
            // groupCountDataGridViewTextBoxColumn
            // 
            this.groupCountDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
            this.groupCountDataGridViewTextBoxColumn.DataPropertyName = "GroupCount";
            this.groupCountDataGridViewTextBoxColumn.HeaderText = "GroupCount";
            this.groupCountDataGridViewTextBoxColumn.Name = "groupCountDataGridViewTextBoxColumn";
            this.groupCountDataGridViewTextBoxColumn.ReadOnly = true;
            this.groupCountDataGridViewTextBoxColumn.Width = 89;
            // 
            // rulesetCountDataGridViewTextBoxColumn
            // 
            this.rulesetCountDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
            this.rulesetCountDataGridViewTextBoxColumn.DataPropertyName = "RulesetCount";
            this.rulesetCountDataGridViewTextBoxColumn.HeaderText = "RulesetCount";
            this.rulesetCountDataGridViewTextBoxColumn.Name = "rulesetCountDataGridViewTextBoxColumn";
            this.rulesetCountDataGridViewTextBoxColumn.ReadOnly = true;
            this.rulesetCountDataGridViewTextBoxColumn.Width = 96;
            // 
            // nameDataGridViewTextBoxColumn2
            // 
            this.nameDataGridViewTextBoxColumn2.DataPropertyName = "Name";
            this.nameDataGridViewTextBoxColumn2.HeaderText = "Name";
            this.nameDataGridViewTextBoxColumn2.Name = "nameDataGridViewTextBoxColumn2";
            this.nameDataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            // 
            // commentDataGridViewTextBoxColumn2
            // 
            this.commentDataGridViewTextBoxColumn2.DataPropertyName = "Comment";
            this.commentDataGridViewTextBoxColumn2.HeaderText = "Comment";
            this.commentDataGridViewTextBoxColumn2.Name = "commentDataGridViewTextBoxColumn2";
            this.commentDataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            // 
            // groupCountDataGridViewTextBoxColumn1
            // 
            this.groupCountDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
            this.groupCountDataGridViewTextBoxColumn1.DataPropertyName = "GroupCount";
            this.groupCountDataGridViewTextBoxColumn1.HeaderText = "GroupCount";
            this.groupCountDataGridViewTextBoxColumn1.Name = "groupCountDataGridViewTextBoxColumn1";
            this.groupCountDataGridViewTextBoxColumn1.ReadOnly = true;
            this.groupCountDataGridViewTextBoxColumn1.Width = 89;
            // 
            // rulesetCountDataGridViewTextBoxColumn1
            // 
            this.rulesetCountDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
            this.rulesetCountDataGridViewTextBoxColumn1.DataPropertyName = "RulesetCount";
            this.rulesetCountDataGridViewTextBoxColumn1.HeaderText = "RulesetCount";
            this.rulesetCountDataGridViewTextBoxColumn1.Name = "rulesetCountDataGridViewTextBoxColumn1";
            this.rulesetCountDataGridViewTextBoxColumn1.ReadOnly = true;
            this.rulesetCountDataGridViewTextBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            this.rulesetCountDataGridViewTextBoxColumn1.Width = 77;
            // 
            // GroupBinder
            // 
            this.GroupBinder.DataSource = typeof(crdmcgui.RulesetGroup);
            // 
            // nameDataGridViewTextBoxColumn3
            // 
            this.nameDataGridViewTextBoxColumn3.DataPropertyName = "Name";
            this.nameDataGridViewTextBoxColumn3.HeaderText = "Name";
            this.nameDataGridViewTextBoxColumn3.Name = "nameDataGridViewTextBoxColumn3";
            // 
            // quickViewDataGridViewTextBoxColumn2
            // 
            this.quickViewDataGridViewTextBoxColumn2.DataPropertyName = "QuickView";
            this.quickViewDataGridViewTextBoxColumn2.HeaderText = "QuickView";
            this.quickViewDataGridViewTextBoxColumn2.Name = "quickViewDataGridViewTextBoxColumn2";
            this.quickViewDataGridViewTextBoxColumn2.ReadOnly = true;
            // 
            // commentDataGridViewTextBoxColumn3
            // 
            this.commentDataGridViewTextBoxColumn3.DataPropertyName = "Comment";
            this.commentDataGridViewTextBoxColumn3.HeaderText = "Comment";
            this.commentDataGridViewTextBoxColumn3.Name = "commentDataGridViewTextBoxColumn3";
            // 
            // keyDataGridViewTextBoxColumn
            // 
            this.keyDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.keyDataGridViewTextBoxColumn.DataPropertyName = "Key";
            this.keyDataGridViewTextBoxColumn.HeaderText = "Variable Name";
            this.keyDataGridViewTextBoxColumn.Name = "keyDataGridViewTextBoxColumn";
            this.keyDataGridViewTextBoxColumn.ReadOnly = true;
            this.keyDataGridViewTextBoxColumn.Width = 250;
            // 
            // valueDataGridViewTextBoxColumn
            // 
            this.valueDataGridViewTextBoxColumn.DataPropertyName = "Value";
            this.valueDataGridViewTextBoxColumn.HeaderText = "Value";
            this.valueDataGridViewTextBoxColumn.Name = "valueDataGridViewTextBoxColumn";
            this.valueDataGridViewTextBoxColumn.ReadOnly = true;
            // 
            // RulesetBinder
            // 
            this.RulesetBinder.DataSource = typeof(crdmcgui.Ruleset);
            // 
            // dgvtcRulesetRuleField
            // 
            this.dgvtcRulesetRuleField.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.dgvtcRulesetRuleField.DataPropertyName = "Field";
            this.dgvtcRulesetRuleField.HeaderText = "Field";
            this.dgvtcRulesetRuleField.Name = "dgvtcRulesetRuleField";
            this.dgvtcRulesetRuleField.ReadOnly = true;
            this.dgvtcRulesetRuleField.Width = 158;
            // 
            // dgvRulesetRuleComparison
            // 
            this.dgvRulesetRuleComparison.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.dgvRulesetRuleComparison.DataPropertyName = "Modifier";
            this.dgvRulesetRuleComparison.HeaderText = "Modifier";
            this.dgvRulesetRuleComparison.Name = "dgvRulesetRuleComparison";
            this.dgvRulesetRuleComparison.ReadOnly = true;
            this.dgvRulesetRuleComparison.Width = 150;
            // 
            // dgvtcRulesetRuleQuickView
            // 
            this.dgvtcRulesetRuleQuickView.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.dgvtcRulesetRuleQuickView.DataPropertyName = "QuickView";
            this.dgvtcRulesetRuleQuickView.HeaderText = "Quick View";
            this.dgvtcRulesetRuleQuickView.Name = "dgvtcRulesetRuleQuickView";
            this.dgvtcRulesetRuleQuickView.ReadOnly = true;
            this.dgvtcRulesetRuleQuickView.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            this.dgvtcRulesetRuleQuickView.Visible = false;
            this.dgvtcRulesetRuleQuickView.Width = 158;
            // 
            // dgvtcRulesetRuleTestValue
            // 
            this.dgvtcRulesetRuleTestValue.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            this.dgvtcRulesetRuleTestValue.DataPropertyName = "TestValue";
            this.dgvtcRulesetRuleTestValue.HeaderText = "Test Value";
            this.dgvtcRulesetRuleTestValue.Name = "dgvtcRulesetRuleTestValue";
            this.dgvtcRulesetRuleTestValue.ReadOnly = true;
            // 
            // fieldDataGridViewTextBoxColumn1
            // 
            this.fieldDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.fieldDataGridViewTextBoxColumn1.DataPropertyName = "Field";
            this.fieldDataGridViewTextBoxColumn1.FillWeight = 178.7234F;
            this.fieldDataGridViewTextBoxColumn1.HeaderText = "Field";
            this.fieldDataGridViewTextBoxColumn1.Name = "fieldDataGridViewTextBoxColumn1";
            this.fieldDataGridViewTextBoxColumn1.ReadOnly = true;
            this.fieldDataGridViewTextBoxColumn1.Width = 150;
            // 
            // modifierDataGridViewTextBoxColumn1
            // 
            this.modifierDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.modifierDataGridViewTextBoxColumn1.DataPropertyName = "Modifier";
            this.modifierDataGridViewTextBoxColumn1.HeaderText = "Modifier";
            this.modifierDataGridViewTextBoxColumn1.Name = "modifierDataGridViewTextBoxColumn1";
            this.modifierDataGridViewTextBoxColumn1.ReadOnly = true;
            this.modifierDataGridViewTextBoxColumn1.Width = 150;
            // 
            // newValueDataGridViewTextBoxColumn
            // 
            this.newValueDataGridViewTextBoxColumn.DataPropertyName = "NewValue";
            this.newValueDataGridViewTextBoxColumn.FillWeight = 21.2766F;
            this.newValueDataGridViewTextBoxColumn.HeaderText = "NewValue";
            this.newValueDataGridViewTextBoxColumn.Name = "newValueDataGridViewTextBoxColumn";
            this.newValueDataGridViewTextBoxColumn.ReadOnly = true;
            // 
            // gui
            // 
            this.AllowDrop = true;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(891, 622);
            this.Controls.Add(this.tabControl1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.Name = "gui";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.Text = "crdmcg";
            this.Shown += new System.EventHandler(this.gui_Shown);
            this.tabControl1.ResumeLayout(false);
            this.tabSimple.ResumeLayout(false);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
            this.splitContainer1.ResumeLayout(false);
            this.toolStripContainer1.BottomToolStripPanel.ResumeLayout(false);
            this.toolStripContainer1.BottomToolStripPanel.PerformLayout();
            this.toolStripContainer1.ContentPanel.ResumeLayout(false);
            this.toolStripContainer1.ResumeLayout(false);
            this.toolStripContainer1.PerformLayout();
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            this.pnlGeneral.ResumeLayout(false);
            this.pnlGeneral.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvCollectionRulesets)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionRulesetBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dgvCollectionGroups)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionGroupBinder)).EndInit();
            this.pnlGroups.ResumeLayout(false);
            this.pnlGroups.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvGroupGroups)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.GroupGroupBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dgvGroupRulesets)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.GroupRulesetBinder)).EndInit();
            this.pnlVariables.ResumeLayout(false);
            this.pnlVariables.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvCollectionVariables)).EndInit();
            this.pnlRulesets.ResumeLayout(false);
            this.pnlRulesets.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvRulesetRules)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.RuleBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dgvRulesetActions)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ActionBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.tabText.ResumeLayout(false);
            this.tabText.PerformLayout();
            this.contextMenuStrip1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.CollectionVariablesBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.CollectionBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.GroupBinder)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.RulesetBinder)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion

        #region Text Edit

        //string searchLabelText = "search ...";

        //private void textBoxSearch_DoubleClick(object sender, EventArgs e)
        //{
        //    FindString();
        //}

        //private void FindString()
        //{
        //    if (textBoxSearch.Text.Trim() == "" || textBoxSearch.Text == searchLabelText)
        //    {
        //        return;
        //    }

        //    string myText = textBox1.Text.ToLower();

        //    try
        //    {
        //        int pos = myText.IndexOf(textBoxSearch.Text.ToLower());
        //        textBox1.SelectionStart = pos;
        //        textBox1.SelectionLength = textBoxSearch.Text.Length;
        //        textBox1.Focus();
        //        textBox1.ScrollToCaret();
        //    }
        //    catch
        //    {
        //        MessageBox.Show(string.Format("End of rule set reached: \"{0}\" was not found.", textBoxSearch.Text),
        //            "Data Manager for ComicRack");
        //        SetLineInfo();
        //    }
        //}

        //private void SetLineInfo()
        //{

        //}

        //private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    WriteRuleFile();
        //    LoadGroups();
        //}

        //private void LoadGroups()
        //{
        //    throw new NotImplementedException();
        //}

        //private void WriteRuleFile()
        //{
        //    throw new NotImplementedException();
        //}

        //private void textBoxSearch_Enter(object sender, EventArgs e)
        //{
        //    textBoxSearch.ForeColor = System.Drawing.Color.Black;
        //    if (textBoxSearch.Text == searchLabelText)
        //    {
        //        textBoxSearch.Text = "";
        //    }
        //}

        //private void textBoxSearch_Leave(object sender, EventArgs e)
        //{
        //    if (textBoxSearch.Text == "")
        //    {
        //        textBoxSearch.ForeColor = System.Drawing.Color.Gray;
        //        textBoxSearch.Text = searchLabelText;
        //    }
        //}

        //private void buttonFind_Click(object sender, EventArgs e)
        //{
        //    FindString();
        //}

        //private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    if (tabControl1.SelectedIndex == 1)
        //    {
        //        textBox1.Text = CompileResults();
        //    }
        //}

        #endregion

        #region TreeView

        private void PopulateTree()
        {
            tvCollectionTree.Nodes.Clear();

            if (Collection == null)
            {
                Collection = new RulesetCollection();
            }

            //initial node
            TreeNode collectionNode = CreateCollectionNode();

            tvCollectionTree.Nodes.Add(collectionNode);

            CreateResidualsNode();

            for (int i = 0; i < Collection.GroupCount; i++)
            {
                //createNode
                TreeNode ndItem = CreateGroupNode(Collection.Groups[i]);
                //populate groups
                tvCollectionTree.Nodes[0].Nodes.Add(ndItem);
            }

            for (int i = 0; i < Collection.RulesetCount; i++)
            {
                TreeNode ndItem = CreateRulesetNode(Collection.Rulesets[i]);
                tvCollectionTree.Nodes[0].Nodes.Add(ndItem);
            }

            //CreateVariablesNode();
            tvCollectionTree.SelectedNode = tvCollectionTree.Nodes[0];
        }

        private TreeNode CreateCollectionNode()
        {
            TreeNode tmp = new TreeNode("Ruleset Collection");
            tmp.Name = "ndCollection";

            tmp.ImageIndex = 0;
            tmp.SelectedImageIndex = 0;

            tmp.Tag = Collection;

            return tmp;
        }

        private void CreateResidualsNode()
        {
            TreeNode ndResidual = CreateGroupNode(Collection.Residual);
            ndResidual.Text = "Disabled Rules";
            ndResidual.Name = "ndDisabled";
            ndResidual.SelectedImageIndex = 18;
            ndResidual.ImageIndex = 18;
            tvCollectionTree.Nodes.Add(ndResidual);
        }

        private void CreateVariablesNode()
        {
            TreeNode ndVariables = new TreeNode("Variables", 1, 1);
            ndVariables.Name = "ndVariables";
            tvCollectionTree.Nodes[0].Nodes.Insert(0, ndVariables);
        }

        private TreeNode CreateGroupNode(RulesetGroup item)
        {
            TreeNode ndItem = new TreeNode(item.Name);
            ndItem.Tag = item;
            ndItem.ImageIndex = 20;
            ndItem.SelectedImageIndex = 21;

            for (int i = 0; i < item.Groups.Count; i++)
            {
                //create and add group nodes for children groups
                TreeNode tmpNode = CreateGroupNode(item.Groups[i]);
                ndItem.Nodes.Add(tmpNode);
            }

            //create Ruleset Nodes for Group
            for (int i = 0; i < item.Rulesets.Count; i++)
            {
                //create and add group nodes for children groups
                TreeNode tmpNode = CreateRulesetNode(item.Rulesets[i]);
                ndItem.Nodes.Add(tmpNode);
            }


            return ndItem;
        }

        private TreeNode InsertGroupNode(int index, RulesetGroup item, TreeNode ParentNode)
        {
            TreeNode ndItem = new TreeNode(item.Name);
            ndItem.Tag = item;
            ndItem.ImageIndex = 2;
            ndItem.SelectedImageIndex = 3;

            for (int i = 0; i < item.GroupCount; i++)
            {
                ndItem.Nodes.Add(CreateGroupNode(item.Groups[i]));
            }

            foreach (Ruleset rsItem in item.Rulesets)
            {
                ndItem.Nodes.Add(CreateRulesetNode(rsItem));
                // ndItem.ContextMenuStrip = cmsTreeMenuRulesetGroups;
            }


            ParentNode.Nodes.Insert(index, ndItem);

            return ndItem;
        }

        private TreeNode CreateRulesetNode(Ruleset rsItem)
        {
            TreeNode ndItem = new TreeNode(rsItem.Name);
            ndItem.Tag = rsItem;
            ndItem.ImageIndex = 2;
            ndItem.SelectedImageIndex = 2;
            //ndItem.ContextMenuStrip = cmsTreeMenuRulests;
            return ndItem;
        }

        private void tvCollectionTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            pnlGeneral.Visible = false;
            pnlVariables.Visible = false;
            pnlGroups.Visible = false;
            pnlVariables.Visible = false;
            pnlRulesets.Visible = false;
            GroupBinder.Clear();
            RulesetBinder.Clear();

            switch (tvCollectionTree.SelectedNode.Name)
            {
                case "ndVariables":
                    pnlVariables.Visible = true;
                    break;
                default:
                    object item = tvCollectionTree.SelectedNode.Tag;
                    if (tvCollectionTree.SelectedNode.Tag != null)
                    {
                        if (item.GetType() == typeof(Ruleset))
                        {
                            RulesetBinder.Add(item);
                            pnlRulesets.Visible = true;
                        }

                        else if (item.GetType() == typeof(RulesetGroup))
                        {
                            pnlGroups.Visible = true;
                            GroupBinder.Add(tvCollectionTree.SelectedNode.Tag);
                        }
                        else if (item.GetType() == typeof(RulesetCollection))
                        {
                            pnlGeneral.Visible = true;
                            CollectionBinder.ResetBindings(false);
                        }
                    }
                    break;
            }
        }

        private void tvCollectionTree_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            if (tvCollectionTree.SelectedNode.Tag != null)
            {
                string NewName = e.Label;

                if (tvCollectionTree.SelectedNode.Tag.GetType() == typeof(RulesetGroup))
                {
                    ((RulesetGroup)tvCollectionTree.SelectedNode.Tag).Name = NewName;
                    GroupBinder.ResetBindings(false);
                }
                if (tvCollectionTree.SelectedNode.Tag.GetType() == typeof(Ruleset))
                {
                    ((Ruleset)tvCollectionTree.SelectedNode.Tag).Name = NewName;
                    RulesetBinder.ResetBindings(false);
                }
            }

        }

        #endregion

        #region Binders Handling

        void CollectionGroupBinder_PositionChanged(object sender, EventArgs e)
        {
            btnCollectionGroupRemove.Enabled = CollectionGroupBinder.Position > -1;
        }

        private void CollectionRulesetBinder_PositionChanged(object sender, EventArgs e)
        {
            btnCollectionRulesetsRemove.Enabled = CollectionRulesetBinder.Position > -1;
        }

        private void GroupGroupBinder_PositionChanged(object sender, EventArgs e)
        {
            btnGroupGroupRemove.Enabled = GroupGroupBinder.Position > -1;
        }

        private void GroupRulesetBinder_PositionChanged(object sender, EventArgs e)
        {
            btnGroupRulesetRemove.Enabled = GroupRulesetBinder.Position > -1;
        }

        private void RuleBinder_PositionChanged(object sender, EventArgs e)
        {
            btnRulesetRuleUpdate.Enabled = RuleBinder.Count > 0;
            btnRulesetActionRemove.Enabled = btnRulesetActionUpdate.Enabled = ActionBinder.Position > -1;
            if (RuleBinder.Position < 0) return;

            Rule tmp = (Rule)RuleBinder.Current;
            SetRule(tmp);
        }

        private void ActionBinder_PositionChanged(object sender, EventArgs e)
        {
            btnRulesetActionRemove.Enabled = btnRulesetActionUpdate.Enabled = ActionBinder.Position > -1;
            if (ActionBinder.Position < 0) return;

            //load the action into the action editor
            Action tmp = (Action)ActionBinder.Current;

            SetAction(tmp);
        }

        private void SetRule(Rule rule)
        {
            cmbRuleField.SelectedItem = Enum.GetName(typeof(AcceptedKeys), rule.Field);
            cmbRuleComparison.SelectedItem = Enum.GetName(typeof(Criteria), rule.Modifier);
            txtRuleTestValue.Text = rule.TestValue;
        }

        private void SetAction(Action tmp)
        {
            cmbActionField.SelectedItem = Enum.GetName(typeof(AcceptedValues), tmp.Field);
            cmbActionAction.SelectedItem = Enum.GetName(typeof(ValueActions), tmp.Modifier);
            txtActionNewValue.Text = tmp.NewValue;
        }

        #endregion

        #region Collection Panel

        private void btnCollectionGroupAdd_Click(object sender, EventArgs e)
        {
            //get the treenode cause we'll be adding a node to it
            TreeNode tmpNode = tvCollectionTree.Nodes[0];

            //create new group
            RulesetGroup tmpGroup = new RulesetGroup();
            tmpGroup.Comment = "Edit the details for your new group";


            CollectionGroupBinder.Add(tmpGroup);
            TreeNode newNode = CreateGroupNode(tmpGroup);
            //Insert in tree
            tmpNode.Nodes.Insert(Collection.IndexOfGroup(tmpGroup), newNode);
        }

        private void btnCollectionGroupRemove_Click(object sender, EventArgs e)
        {
            if (CollectionGroupBinder.Position < 0) return;

            tvCollectionTree.SelectedNode.Nodes.RemoveAt(CollectionGroupBinder.Position);

            CollectionGroupBinder.RemoveCurrent();
        }

        private void btnCollectionGroupMoveUp_Click(object sender, EventArgs e)
        {

        }

        private void btnCollectionGroupMoveDown_Click(object sender, EventArgs e)
        {

        }

        private void btnCollectionRulesetsAdd_Click(object sender, EventArgs e)
        {
            TreeNode tmpNode = tvCollectionTree.Nodes[0];
            DataManagerNode dmnItem = (DataManagerNode)tmpNode.Tag;

            Ruleset tmpRS = new Ruleset();
            tmpRS.Comment = "Edit the details of your new Ruleset.";

            //put it in the collection.
            CollectionRulesetBinder.Add(tmpRS);
            TreeNode nd = CreateRulesetNode(tmpRS);
            //put it in the tree
            tmpNode.Nodes.Add(nd);
        }

        private void btnCollectionRulesetsRemove_Click(object sender, EventArgs e)
        {
            if (CollectionRulesetBinder.Position < 0) return;

            //remove from tree
            int fix = Collection.Groups.Count;

            //use position of current to find index of ruleset
            tvCollectionTree.Nodes[0].Nodes.RemoveAt(fix + CollectionRulesetBinder.Position);

            CollectionRulesetBinder.RemoveCurrent();
        }

        private void btnCollectionRulesetMoveUp_Click(object sender, EventArgs e)
        {

        }

        private void btnCollectionRulesetMoveDown_Click(object sender, EventArgs e)
        {

        }

        #endregion

        #region Group Panel

        private void btnGroupGroupMoveUp_Click(object sender, EventArgs e)
        {

        }

        private void btnGroupGroupMoveDown_Click(object sender, EventArgs e)
        {

        }

        private void btnGroupGroupRemove_Click(object sender, EventArgs e)
        {
            if (GroupGroupBinder.Position < 0) return;

            tvCollectionTree.SelectedNode.Nodes.RemoveAt(GroupGroupBinder.Position);

            GroupGroupBinder.RemoveCurrent();
        }

        private void btnGroupGroupAdd_Click(object sender, EventArgs e)
        {
            //get tree node
            TreeNode myNode = tvCollectionTree.SelectedNode;
            //get group
            DataManagerNode dmnTemp = (DataManagerNode)myNode.Tag;

            //create a group
            RulesetGroup newGroup = new RulesetGroup();
            newGroup.Comment = "Edit the Details of your new group";

            //add to Binder
            GroupGroupBinder.Add(newGroup);

            //create a node for the group
            TreeNode newNode = CreateGroupNode(newGroup);

            //add the new node
            myNode.Nodes.Insert(dmnTemp.IndexOfGroup(newGroup), newNode);

            //move to new node
            //tvCollectionTree.SelectedNode = newNode;

        }

        private void btnGroupRulesetMoveUp_Click(object sender, EventArgs e)
        {

        }

        private void btnGroupRulesetMoveDown_Click(object sender, EventArgs e)
        {

        }

        private void btnGroupRulesetRemove_Click(object sender, EventArgs e)
        {
            if (GroupRulesetBinder.Position < 0) return;

            //remove from tree
            int fix = Collection.Groups.Count - 1;

            //use position of current to find index of ruleset
            tvCollectionTree.SelectedNode.Nodes.RemoveAt(fix + GroupRulesetBinder.Position);

            GroupRulesetBinder.RemoveCurrent();
        }

        private void btnGroupRulesetAdd_Click(object sender, EventArgs e)
        {
            TreeNode tmpNode = tvCollectionTree.SelectedNode;
            DataManagerNode dmnItem = (DataManagerNode)tmpNode.Tag;

            Ruleset tmpRS = new Ruleset();
            tmpRS.Comment = "Edit the details of your new Ruleset.";

            //put it in the group.
            GroupRulesetBinder.Add(tmpRS);
            TreeNode nd = CreateRulesetNode(tmpRS);
            //put it in the tree
            tmpNode.Nodes.Add(nd);

            //navigate to it.
            //tvCollectionTree.SelectedNode = nd;
        }

        private void txtGroupName_Validated(object sender, EventArgs e)
        {
            if (tvCollectionTree.SelectedNode.Tag.GetType() != typeof(RulesetGroup)) return;
            //group
            RulesetGroup tmp = (RulesetGroup)tvCollectionTree.SelectedNode.Tag;
            //SelectedNode
            tvCollectionTree.SelectedNode.Text = tmp.Name;
        }

        private void txtGroupComment_Validated(object sender, EventArgs e)
        {
            if (tvCollectionTree.SelectedNode.Tag.GetType() != typeof(RulesetGroup)) return;
            //grouup
            RulesetGroup tmp = (RulesetGroup)tvCollectionTree.SelectedNode.Tag;
            //SelectedNode
            tvCollectionTree.SelectedNode.ToolTipText = ((RulesetGroup)tvCollectionTree.SelectedNode.Tag).Comment;
        }

        #endregion

        #region Ruleset Panel



        private void txtRulesetName_Validated(object sender, EventArgs e)
        {
            if (tvCollectionTree.SelectedNode.Tag.GetType() != typeof(Ruleset)) return;
            if (tvCollectionTree.SelectedNode.Text != txtRulesetName.Text)
            {
                tvCollectionTree.SelectedNode.Text = txtRulesetName.Text;
            }
        }

        private void txtRulesetComment_Validated(object sender, EventArgs e)
        {
            if (tvCollectionTree.SelectedNode.Tag.GetType() != typeof(Ruleset)) return;
            if (tvCollectionTree.SelectedNode.ToolTipText != txtRulesetComment.Text)
            {
                tvCollectionTree.SelectedNode.ToolTipText = txtRulesetComment.Text;
            }
        }
        private void btnRulesetRuleUpdate_Click(object sender, EventArgs e)
        {
            if (RuleBinder.Position < 0) return;
            Rule tmp = GetRuleResults();
            ((Rule)RuleBinder.Current).Copy(tmp);
            RuleBinder.ResetCurrentItem();
        }

        private Rule GetRuleResults()
        {
            return new Rule(cmbRuleField.Text, cmbRuleComparison.Text, txtRuleTestValue.Text);
        }

        private void btnRulesetRuleAdd_Click(object sender, EventArgs e)
        {
            Rule tmp = GetRuleResults();

            if (!RuleBinder.List.Contains(tmp))
            {
                RuleBinder.Add(tmp);
            }
            else
            {
                MessageBox.Show("This exact rule already exists, duplicating it will give no benefits.", "Rule Exists", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }

        private void btnRulesetRuleRemove_Click(object sender, EventArgs e)
        {
            if (RuleBinder.Position < 0) return;

            RuleBinder.RemoveCurrent();
        }

        private void btnRulesetRuleClear_Click(object sender, EventArgs e)
        {
            RuleBinder.Clear();
        }

        private void btnRulesetActionClear_Click(object sender, EventArgs e)
        {
            ActionBinder.Clear();
        }

        private void btnRulesetActionRemove_Click(object sender, EventArgs e)
        {
            if (ActionBinder.Position < 0) return;
            ActionBinder.RemoveCurrent();
        }

        private void btnRulesetActionAdd_Click(object sender, EventArgs e)
        {
            Action tmp = GetActionResult();
            if (!ActionBinder.List.Contains(tmp))
                ActionBinder.Add(tmp);
            else
                MessageBox.Show("This exact action already exists, duplicating it will give no benefits.", "Action Exists", MessageBoxButtons.OK, MessageBoxIcon.Stop);

        }

        private Action GetActionResult()
        {
            Action tmp = new Action();
            tmp.Field = (AcceptedValues)Enum.Parse(typeof(AcceptedValues), cmbActionField.Text);
            tmp.Modifier = (ValueActions)Enum.Parse(typeof(ValueActions), cmbActionAction.Text);
            tmp.NewValue = txtActionNewValue.Text;

            return tmp;
        }

        private void btnRulesetActionUpdate_Click(object sender, EventArgs e)
        {
            Action tmp = GetActionResult();
            ((Action)ActionBinder.Current).Copy(tmp);
            ActionBinder.ResetCurrentItem();
        }

        #endregion

        #region Ressidual & Variables Panels
        private void txtCollectionresidual_Validated(object sender, EventArgs e)
        {

        }

        #endregion

        #region File Management

        private void btnSave_Click(object sender, EventArgs e)
        {
            ValidateChildren();
            if (this.filePath != null)
            {
                SaveFile();
            }
            else
            {
                btnSaveAs_Click(sender, e);
            }
        }

        private void btnSaveAs_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog tmp = new SaveFileDialog())
            {
                tmp.AutoUpgradeEnabled = true;
                tmp.OverwritePrompt = true;
                tmp.Filter = FileFilters;
                tmp.FilterIndex = 0;
                tmp.AddExtension = true;
                tmp.DefaultExt = ".dmr";

                if (tmp.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    filePath = tmp.FileName;
                    SaveFile();
                }
            }
        }

        private void btnRevert_Click(object sender, EventArgs e)
        {
            if (this.filePath != null)
            {
                ParseRules(filePath);
                PopulateTree();
            }
            else
            {
                btnRevert_DoubleClick(sender, e);
            }
        }

        private string CompileResults()
        {
            return Collection.TextVersion;
        }

        private void SaveFile()
        {
            System.IO.File.WriteAllLines(filePath, Collection.TextVersion.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None));
        }

        private void SaveFile(string p)
        {
            System.IO.File.WriteAllLines(p, Collection.TextVersion.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None));
        }

        void ParseRules(string p)
        {
            GroupBinder.Clear();
            RulesetBinder.Clear();
            Collection = new RulesetCollection(p);
            PopulateTree();
        }

        private string[] ReadFile(string strFilePath)
        {
            return System.IO.File.ReadAllLines(strFilePath);
        }

        #endregion

        private void cmbRuleField_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbRuleComparison.Items.Clear();
            if (cmbRuleField.SelectedIndex < 0) return;
            cmbRuleComparison.Items.AddRange(GetAcceptableComparisonFields(cmbRuleField.Text));
            if (cmbRuleComparison.Items.Count > 0) cmbRuleComparison.SelectedIndex = 0;
        }

        private string[] GetAcceptableComparisonFields(string strAllowedKey)
        {
            AcceptedKeys tmp = (AcceptedKeys)(Enum.Parse(typeof(AcceptedKeys), strAllowedKey));
            return tmp.GettAllowedKeyModifiers();
        }

        private void cmbRuleComparison_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbRuleComparison.SelectedIndex < 0) return;
        }

        private void cmbActionField_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbActionAction.Items.Clear();
            if (cmbActionField.SelectedIndex < 0) return;
            cmbActionAction.Items.AddRange(GetAcceptableActionFields(cmbActionField.Text));
            if (cmbActionAction.Items.Count > 0) cmbActionAction.SelectedIndex = 0;
        }

        private string[] GetAcceptableActionFields(string p)
        {
            AcceptedValues tmp = (AcceptedValues)Enum.Parse(typeof(AcceptedValues), p);
            return tmp.GetAllowedValueActions();
        }

        private void cmbActionAction_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbActionAction.SelectedIndex < 0) return;
        }

        private void btnRevert_DoubleClick(object sender, EventArgs e)
        {
            using (OpenFileDialog ofdOpen = new OpenFileDialog())
            {
                ofdOpen.Title = "Select a file to set as default";
                ofdOpen.AutoUpgradeEnabled = true;
                ofdOpen.InitialDirectory = Environment.CurrentDirectory;
                ofdOpen.RestoreDirectory = true;
                ofdOpen.Filter = FileFilters;
                ofdOpen.DefaultExt = ".dat";
                ofdOpen.FilterIndex = 0;

                if (ofdOpen.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    filePath = ofdOpen.FileName;
                    Collection.Parse(ReadFile(ofdOpen.FileName));
                    CollectionBinder.ResetBindings(false);
                    PopulateTree();
                }
            }
        }

        private void btnRevert_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
                btnRevert_Click(sender, e);
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
                btnRevert_DoubleClick(sender, e);
        }

        private void tvCollectionTree_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (((TreeNode)e.Item).Tag != null)
                if (((TreeNode)e.Item).Tag.GetType() != typeof(RulesetCollection))
                {
                    DoDragDrop(e.Item, DragDropEffects.Move);
                }
        }

        private void tvCollectionTree_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
                Type DestinationNodeType = DestinationNode.Tag.GetType();
                TreeNode NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                Type NewNodeType = NewNode.Tag.GetType();

                if (DestinationNode != NewNode && DestinationNode != NewNode.Parent)
                {
                    if (NewNode.Tag != null)
                    {
                        if (NewNodeType != typeof(RulesetCollection))
                        {
                            if (NewNodeType == typeof(Ruleset))
                            {
                                //delete the Ruleset from it's parent
                                DataManagerNode tmp = (DataManagerNode)NewNode.Parent.Tag;

                                if (GroupRulesetBinder.Contains(NewNode.Tag))
                                {
                                    GroupRulesetBinder.Remove(NewNode.Tag);
                                    GroupRulesetBinder.ResetBindings(false);
                                }
                                else if (CollectionRulesetBinder.Contains(NewNode.Tag))
                                {
                                    CollectionRulesetBinder.Remove(NewNode.Tag);
                                    CollectionRulesetBinder.ResetBindings(false);
                                }
                                else tmp.RemoveRuleset((Ruleset)NewNode.Tag);

                                //add the Ruleset to the Group/Collection it's dropped on
                                DataManagerNode DestinationContainer = (DataManagerNode)DestinationNode.Tag;

                                if (DestinationContainer == (DataManagerNode)GroupBinder.Current)
                                {
                                    GroupRulesetBinder.Add(NewNode.Tag);                                 
                                }
                                else if (DestinationContainer == (DataManagerNode)CollectionBinder.Current)
                                {
                                    CollectionRulesetBinder.Add(NewNode.Tag);
                                }
                                else DestinationContainer.AddRuleset((Ruleset)NewNode.Tag);

                                //delete the treenode from the tree
                                tvCollectionTree.Nodes.Remove(NewNode);
                                //add the node to the tree
                                DestinationNode.Nodes.Add(NewNode);
                            }
                            else if (NewNodeType == typeof(RulesetGroup))
                            {
                                //delete the item from its parent
                                DataManagerNode tmp = (DataManagerNode)NewNode.Parent.Tag;
                                if (CollectionGroupBinder.Contains(NewNode.Tag))
                                {
                                    CollectionGroupBinder.Remove(NewNode.Tag);
                                }
                                else if (GroupGroupBinder.Contains(NewNode.Tag))
                                {
                                   GroupGroupBinder.Remove(NewNode.Tag);
                                }
                                else tmp.RemoveGroup((RulesetGroup)NewNode.Tag);

                                //add the RulesetGroup to the Group/Collection it's dropped on
                                DataManagerNode DestinationContainer = (DataManagerNode)DestinationNode.Tag;

                                if (DestinationContainer == (DataManagerNode)GroupBinder.Current)
                                {
                                    GroupGroupBinder.Add(NewNode.Tag);
                                    //delete the treenode from the tree
                                    tvCollectionTree.Nodes.Remove(NewNode);
                                    //add the node to the tree
                                    DestinationNode.Nodes.Insert(GroupGroupBinder.IndexOf(NewNode.Tag), NewNode);
                                }
                                else if (DestinationContainer == (DataManagerNode)CollectionBinder.Current)
                                {
                                    CollectionGroupBinder.Add(NewNode.Tag);
                                    //delete the treenode from the tree
                                    tvCollectionTree.Nodes.Remove(NewNode);
                                    //add the node to the tree
                                    DestinationNode.Nodes.Insert(CollectionGroupBinder.IndexOf(NewNode.Tag), NewNode);
                                }
                                else
                                {
                                    DestinationContainer.AddGroup((RulesetGroup)NewNode.Tag);
                                    //delete the treenode from the tree
                                    tvCollectionTree.Nodes.Remove(NewNode);
                                    //add the node to the tree
                                    DestinationNode.Nodes.Insert(DestinationContainer.Groups.IndexOf((RulesetGroup)NewNode.Tag), NewNode);
                                }



                            }
                            else
                            { }


                        }
                        else return;
                    }
                }
                else
                {

                }
            }
            CollectionBinder.ResetBindings(false);
        }

        private void tvCollectionTree_DragEnter(object sender, DragEventArgs e)
        {

        }

        private void tvCollectionTree_DragLeave(object sender, EventArgs e)
        {

        }

        private void tvCollectionTree_DragOver(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
                if (DestinationNode != null && DestinationNode.Tag != null)
                {
                    Type DestinationNodeType = DestinationNode.Tag.GetType();
                    TreeNode NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                    Type NewNodeType = NewNode.Tag.GetType();

                    if (DestinationNode.FullPath.StartsWith(NewNode.FullPath))
                    {
                        e.Effect = DragDropEffects.Scroll;
                    }
                    else
                    {
                        if (DestinationNodeType == typeof(Ruleset))
                        {
                            e.Effect = DragDropEffects.Scroll;
                        }
                        else
                        {
                            e.Effect = DragDropEffects.Scroll | DragDropEffects.Move;
                        }
                    }
                }
                else
                {
                    e.Effect = DragDropEffects.None;
                }
            }
        }

        private void tvCollectionTree_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
        {

        }

        private void tvCollectionTree_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {

        }

        private void UpdateChildNodeName(int nChildNodeIndex)
        {
            TreeNode tmpNode = tvCollectionTree.SelectedNode.Nodes[nChildNodeIndex];

            tmpNode.Text = ((DataManagerNode)tmpNode.Tag).Name;
        }

        private void dgvGroupGroups_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (tvCollectionTree.SelectedNode == null || e.ColumnIndex != 0) return;

            UpdateChildNodeName(e.RowIndex);

        }

        private void dgvGroupRulesets_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (tvCollectionTree.SelectedNode == null || e.ColumnIndex != 0) return;

            UpdateChildNodeName(CollectionGroupBinder.Count + e.RowIndex);
        }

        private void dgvCollectionGroups_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0) return;
            tvCollectionTree.SelectedNode = tvCollectionTree.SelectedNode.Nodes[e.RowIndex];
        }

        private void dgvCollectionRulesets_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0) return;
            
            tvCollectionTree.SelectedNode = tvCollectionTree.SelectedNode.Nodes[((DataManagerNode)tvCollectionTree.SelectedNode.Tag).Groups.Count + e.RowIndex];
        }

    }
}
